I have developed a webService using axis2 and spring. When I request the
wsdl file from the webservice I get the right wsdl file, but when I want to
use a defined operation of the webservice (using a java client),
I get the following exception:
[CODE]org.apache.axis2.AxisFault: The SERVICE_OBJECT_SUPPLIER parameter is
not specified.
In your services.xml file you need to define following two properties.
org.apache.axis2.extensions.spring.receivers.SpringServletContextObjectSupplier
beanname-that-expose-as-a-WS
Take a look http://axis.apache.org/axis2/java/core/docs/spring.html
Related
I have followed contract first approach. So I first wrote the wsdl file and then generated the server side code. But when I hit the url for my web service in the browser then I see the auto generated wsdl file; not the one I had kept inside META-INF folder. I have also set useOriginalwsdl=true in my services.xml file. When I try to view the wsdl in browser, it fires error
Unable to generate WSDL 1.1 for this service in description section and
If you wish Axis2 to automatically generate the WSDL 1.1, then please set useOriginalwsdl as false in your services.xml in the reason section of error tag.
Please help me.
useOriginalwsdl=true will work if you have followed the following steps:
put the custom wsdl file inside the META-INF folder.
the service name should be the same in both the custom wsdl as well as in the services.xml
Name the custome wsdl as service.wsdl or (Your ServiceName).wsdl.
Set useOriginalwsdl=true in services.xml file
Note: If useOriginalwsdl=true, Axis2 engine first tries to use any wsdl file named service.wsdl. If not found, then it tries to find named (your service name).wsdl
If not succeeds, then it shows error when u try to access the web service.
Do you have external schema references in your WSDL..? If so, those should be also added to META-INF directory... Please also attach your WSDL..
Since you are using contract first, better you validate your WSDL too.. there are wsdl validating tools available...
Thanks...
I am trying to connect to a cXML Web Service using Visual Studio 2010 .NET 4, and when I try to Add a Service Reference to the project using the URL I get the following error (i have masked the url for privacy) why am I getting this error and how can I connect to the web service?...
There was an error downloading 'http://00.00.00.00:8080/xml/servlet/twaaserver?svcname=x10h015'
The request failed with the error message:
--
<h1>Error: 500</h1>
<h2>Location: /xml/servlet/twaaserver</h2><b>Internal Servlet Error:</b><br> <pre>javax.servlet.ServletException
at processService.doProcess(processService.java:447)
at processService.run(processService.java:585)
at twaaserver.doGet(twaaserver.java:429)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
at org.apache.tomcat.core.Handler.service(Handler.java:287)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:812)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:758)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:213)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
at java.lang.Thread.run(Thread.java:534)
</pre>
<b>Root cause:</b>
<pre>java.lang.NullPointerException
at eboservice.transformDataFeeds(eboservice.java:982)
at processService.doProcess(processService.java:279)
at processService.run(processService.java:585)
at twaaserver.doGet(twaaserver.java:429)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
at org.apache.tomcat.core.Handler.service(Handler.java:287)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:812)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:758)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:213)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
at java.lang.Thread.run(Thread.java:534)
</pre>
--.
Metadata contains a reference that cannot be resolved: 'http://00.00.00.00:8080/xml/servlet/twaaserver?svcname=x10h015'.
The content type text/html of the response message does not match the content type of the binding (application/soap+xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 1024 bytes of the response were: '<h1>Error: 500</h1>
<h2>Location: /xml/servlet/twaaserver</h2><b>Internal Servlet Error:</b><br><pre>javax.servlet.ServletException: Warning: can't output text before document element! Ignoring...
at processService.doProcess(processService.java:447)
at processService.run(processService.java:585)
at twaaserver.doGet(twaaserver.java:429)
at twaaserver.doPost(twaaserver.java:535)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
at org.apache.tomcat.core.Handler.service(Handler.java:287)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:812)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:758)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:213)
at org.apache.tomcat.service.'.
The remote server returned an error: (500) Internal Server Error.
If the service is defined in the current solution, try building the solution and adding the service reference again.
There seems to be something wrong with your service or how you call it.
The first thing I usally do is verifying if the service works as expected. Get soapUI import the wsdl and do some sample calls.
Sometimes services go crazy if you don't pass the parameters correctly. If it is not working with soapui clarify what is wrong with the service vendor.
You're right, I figured out the problem was that the web service was not a SOAP service. It is a REST service.
The problem was that I was trying to Add A Service Reference via the Visual Studio tool. This isn't possible with this type of service I was connecting to because it uses cXML and is a REST service (it works very differently).
In my solution I manually wrote Web Service REST calls by doing simple POST and GET requests and passed in the XML in string format.
This worked for me...
I used this tutorial: https://developer.yahoo.com/dotnet/howto-rest_cs.html
I have a model that is used to create a Web Service endpoint on a server. The same model is used for the client. However when a new operation is added to the server but the client still uses the older model, service creation fails with an exception like the following (line breaks added for clarity):
Exception in thread "main" javax.xml.ws.WebServiceException:
Method someNewMethod is exposed as WebMethod, but there is no
corresponding wsdl operation with name someNewMethod in the
wsdl:portType{http://example.com}MyService
I understand the problem but is it possible to ignore this? I'd like to be backwards compatible when consuming the Web service. As long as methods are merely added this should work just fine most of the time.
The problem occurs in the getPort method:
Service s = Service.create(
new URL("http://example.com/foo?wsdl"),
new QName("http://example.com", "MyService"));
MyService m = s.getPort(MyService.class);
Just for reference.
You can also annotate the method with
#WebMethod(exclude=true)
This will make sure the method is ignored for comparing with the wsdl.
Use an local WSDL File:
The client App has an local WSDL File of the service e.g inside the jar file.
The you get it with
URL wsdlURL = this.getClass().getClassLoader()
.getResource("MyWebService.wsdl");
That worked for a App that i wrote. The server later extended an additional WSDL attribute, while the client still uses the local one.
I just deleted the webservice reference and created again using the interface.
Your Service class contains a static constructor with a local wsdl file variable. Check if local wsdl file has the someNewMethod. If not download the wsdl file from original Url and save to local.
The soap address location value at the end of the wsdl is also important.
Sometimes https turns to http.
From within a J2EE application running in JBoss4.2.3 we are creating a SOAPConnection to invoke a 3rd party's web service. Inside the SOAP Header we have to set the Addressing To and Action tags, with 'mustUnderstand' set to '1'. This 'mustUnderstand' attribute is in the http://www.w3.org/2003/05/soap-envelope namespace. We create this by calling:
SOAPFactory#createName("mustUnderstand", "soap", "http://www.w3.org/2003/05/soap-envelope");
This comes out correctly when we include saaj.jar and saaj-impl.jar in our WEB-INF/lib folder. If I take these out, the namespace comes out null as: xmlns:soap='null' instead of xmlns:soap="http://www.w3.org/2003/05/soap-envelope". Here's the entire bad tag:
<wsa:To xmlns:wsa='http://schemas.xmlsoap.org/ws/2004/08/addressing' xmlns:soap='null' soap:mustUnderstand='1'>http://domain/web-service.url</wsa:To>.
But if we have those 2 jar files deployed with the app, our own hosted web-services fail when creating Faults (due to a class-cast exception:
javax.xml.soap.SOAPException: java.lang.ClassCastException: com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl)
Our J2EE app is a JBossWS web-service that invokes 3rd-party web-services itself. There is an apparent conflict with the jar files.
Any ideas on how to get the http://www.w3.org/2003/05/soap-envelope namespace to be written out in the generated SOAP tag?
I ended up using the API directly to call SOAPHeaderElement#mustUnderstand(true). This looks to have solved this issue since another namespace declaration isn't needed (it uses the soap-env namespace declaration from teh envelope itself.
I still have another issue (JBoss wants to send a chunked HTTP request, which the 3rd party web-service isn't liking, but I haven't looked far enough into that one yet)
I'm trying to get hold of the FindService on this wsdl using jaxws.
I generated the classes just fine using wsimport.
But when i do:
FindService findService = new FindService();
i get the exception:
Exception in thread "main" javax.xml.ws.WebServiceException: {http://s.mappoint.net/mappoint-30/}FindService is not a valid service. Valid services are: {http://s.mappoint.net/mappoint-30/}CommonService
So, it seems that jaxws is only finding CommonService in the wsdl which is the first one declared in it.
Any idea how i can use the FindService ?
Thanks.
This appears to be a JAX-WS bug.
You can make a local copy of the WSDL, modify it so that FindService is the first service definition declared, and run wsimport against it. That worked for me.