I'm fairly new to web services and I've successfully created a web service using axis2 and tomcat 7. Now I'm trying to create a client for the web service using wsdl2java. I'm working on Windows so the command I've been trying is this:
C:\axis2-1.5.4\bin> wsdl2java -uri http://localhost:8080/axis2/services/MyService
I've set the AXIS2_HOME, JAVA_HOME, CLASSPATH like this:
AXIS2_HOME -> C:\axis2-1.5.4
JAVA_HOME -> C:\Program Files\Java\jdk1.7.0
set CLASSPATH=C:\axis2-1.5.4\lib\axis.jar;C:\axis2-1.5.4\lib\axis-ant.jar;C:\axis2-1.5.4\lib\commons-discovery-0.2.jar;C:\axis2-1.5.4\lib\commons-logging-1.0.4.jar;C:\axis2-1.5.4\lib\jaxrpc.jar;C:\axis2-1.5.4\lib\log4j-1.2.8.jar;C:\axis2-1.5.4\lib\saaj.jar;C:\axis2-1.5.4\lib\wsdl4j-1.5.1.jar;C:\axis2-1.5.4\lib\activation.jar;C:\axis2-1.5.4\lib\mailapi.jar
My problem is that this: C:\axis2-1.5.4\bin> wsdl2java -uri http://localhost:8080/axis2/services/MyService doesn't produce any output at all in the console and doesn't create the stub class. I've no idea what I'm doing wrong here. I've tried other wsdl files as well and same thing happens. I would really appreciate any suggestions.
Thanks!
Try adding "?wsdl" to the end of the URI: http://localhost:8080/axis2/services/MyService?wsdl. That's the correct form for a URL that returns the WSDL.
Aside from that, the wsdl2java reference says that -uri should name a file on the local filesystem. It may be that HTTP URLs aren't supported.
wsdl2java tools supports http url. But I also think that the problem here is that you URL does not point to the wsdl file (which should be ?wsd)
Related
I am using anypoint studio 7.3.1 with Mule 4.1.x. trying to load the WSDL using Web Service Consumer.
First I placed my WSDL file under src/main/resources of my project.
In Web Service Consumer, under connector configuration I selected my WSDL and at this point the mulesoft should automatically populate “Service”, “Port” and “Address”.
However that is not happening. I read somewhere that WSDL file needs to be exported to mule-artifact.json which I did, but still doesn’t work.
To make sure my WSDL is good, I was able to load the same WSDL in soapUI and was able to access the web service.
What is it that I need to do to get this working? Is there any error log that tells what’s going on? By the way, the endpoint is http so I know there is no cert issue.
the problem was due to the xsd that was referred in the WSDL. Removed that and it worked
I have got below error message when I have enter the URL in WSDL location
Error loading [http://www.mobilefish.com/services/web_service/countries.php?wsdl]: org.apache.xmlbeans.XmlException: org.apache.xmlbeans.XmlException: error: Reference to undefined entity: nbs
I've got the same problem.
I did try to download the wsdl and import the downloaded wsdl... it didn't solve. I also try to found the "entity nbsp" on the file with no results.
This problem is not related with your wsdl but it's a soapUI problem. I had this problem with 5.0.0 version and i installed the 4.5.1 version and it worked =)
Just a note: look out with the proxy setting problem. This version is affected by this problem.. the solution is easy and it's here
So, if you are trying to access a WSDL the first thing i would recommend is try to open it in a web browser(any will do...yes even IE). Do this from the same machine from where you are going to run the test.
This will tell you if you have access to the WSDL from your test machine and if the WSDL is valid.
Once the WSDL opens, copy the URL into the soapUI's new project dialog box. This will create nodes for all service operations in the service and if you have the option selected, it will also create a sample request for each service option.
This is what a wsdl open in a browser(chrome in this case looks like)
This is what the soapUI new project dialog box looks like. Do remember to check "Create sample requests for all operations?" option to create sample requests. You can give it any name..i called it stackoverflow
This is what a wsdl loaded into soapUI looks like, notice the different sub nodes?
If you are looking for WSDL to play with..check out the ones listed on xmethods or webservcex.
Hope this answers both this questions and the other one
I am using eclipse (Juno) to develop a web service for Tomcat 7 and Axis2. I have a java bean which I want to use to create the web service. The web service wizard seems to run ok but when the server starts I get this error message:
2012-11-08 13:31:20,059 ERROR [localhost-startStop-1] configuration.EngineConfigurationFactoryServlet (EngineConfigurationFactoryServlet.java:162) getServerEngineConfig
- Unable to find config file.
Creating new servlet engine config file: /WEB-INF/server-config.wsdd
I understand this to mean that server-config.wsdd is missing. How do I create this file? Why isn't it being generated automatically by the wizard?
Update
I recreated the project and the error message does not appear. I guess that I did something wrong. Perhaps Axis1 was being used as Andreas Veithen suggests below.
That is an error message generated by Axis 1.x. If you are developing an Axis2 service, then you shouldn't attempt to deploy it on Axis 1.x.
While generating java beans or wsdl, select start service option in webservices wizard then eclipse will create the server-confid.wsdd file for you. Hope this helps.
I am attempting to learn Axis2 Web Services, and am working through a tutorial on RoseIndia web site (link text). In the example for the client, it generates the stubs using wsdl2java, and it generates the stubs which use http://localhost:8080, however, when I do it, it creates the stubs to use the secure links https://localhost:8443. I have not installed SSL onto my local dev app server (Tomcat).
I have checked the wsdl2java documentation and can't find any reference to security settings. How would I make these stubs use the basic http://localhost:8080 references
Look at your WSDL file. In Axis2 1.5 the wsdl2java tool will use this SOAP1.2 port to generate the target endpoint for your stub:
<wsdl:port name="HelloWorldServiceHttpSoap12Endpoint" binding="ns:HelloWorldServiceSoap12Binding">
<soap12:address location="http://localhost:8082/axis2/services/HelloWorldService.HelloWorldServiceHttpSoap12Endpoint/" />
</wsdl:port>
You can use the -pn option of wsdl2java if you need to use another port.
Download your WSDL locally and verify that the port section is correct (no https). Further generate the sources with wsdl2java, e.g. on my machine:
lucho#lucholinuxpc:~/axis2-1.5.1/bin> ./wsdl2java.sh -uri /home/lucho/sayhello.wsdl
Using AXIS2_HOME: /home/lucho/axis2-1.5.1
Using JAVA_HOME: /opt/jdk1.6.0_18
Using JAVA_OPTS: -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n
Retrieving document at '/home/lucho/sayhello.wsdl'.
Now check your generated stub, you should see something like this in case your WSDL looks like mine:
/**
* Default Constructor
*/
public HelloWorldServiceStub() throws org.apache.axis2.AxisFault {
this("http://localhost:8082/axis2/services/HelloWorldService.HelloWorldServiceHttpSoap12Endpoint/" );
}
Next, in your test code you may alternatively use a constructor for your stub that takes the target endpoint. Actually I prefer this approach because the WS client is more flexible to changes in the target network. For your question should be something like:
public HelloWorldServiceStub(java.lang.String targetEndpoint)
And last but not least I recommend you this book for quick start-up tutorial SOAP Attachments using apache axis2
Cheerz!
So I've been developing an app on my dev box for a while and it's time to put it in production. My Service has a method which returns Xml.
This all works locally but when I copy the files over to the web server and try to connect to my WCS using a browser I get this message:
The content type text/html of the response message does not match the content type of the binding (text/xml; charset=utf-8).
Why does it work locally? Has my hosting provider setup something wrong? Have I messed up some config or other? Thanks in advance.
Has the production environment been properly set up?
If not, run ServiceModelReg.exe to register WCF http modules / mappings etc.
http://msdn.microsoft.com/en-us/library/ms732012.aspx
--larsw