I'm using an Axis2 client to access an external Webservice, whose WSDL starts with the following content:
<?xml version="1.0" encoding="UTF-8"?><!--Created by TIBCO WSDL--><wsdl:definitions xmlns:wsdl=...
My call to sendReceive crashes with the following error:
com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 'C' (code 67) in prolog; expected '<'
The 'C' is the first character on the comment in the WSDL. Without that comment everything works fine, but as far as my knowledge of basic XML dictates that comment is correct. My question would be: Is this a bug in Axis2 or is the accessed WSDL malformed? Is there any way to prevent Axis2 from crashing under these circumstances?
You should use wsdl documentation for it.Check the following links:
http://www.w3.org/TR/wsdl#_documentation
http://www.ws-i.org/Profiles/BasicProfile-1.1.html#WSDL_documentation_Element
After debugging the communications, I found out that the "C" was a red herring, and in fact the supplier's server was responding with the following text error message: Can not get operation configuration - invalid soapAction for input message.
The problem was that the soapAction header was not being sent in the HTTP request, after adding it everything worked fine.
Related
I am calling a REST based service and the URL that I am calling doesn't show any XML tags but by pressing F12 (developer mode) I found out that the response code is 200 meaning it is successful.
I am kind of lost here. What I am suppose to do at the back end because I also get premature end of file exception. If I am getting a 200 response code then why it is throwing premature end of file exception?
Thanks...
So this is for the starters. While calling a third party service we need to make sure that we are providing the authentication credentials as part of the request header. In my case I wasn't supplying them but the strange thing was that I was getting a OK response but down the line it was throwing premature end of file exception.
So once I provided the credentials for the service it went through and now I can see the beautiful XML payload.
Happy coding...
I get this java.lang.ClassCastException by trying to communicate with my Webservice which has SOAPHeader Handler implimentation.
The error occurs by
String data= ((Text) ((SOAPElement) is.next()).getChildElements().next()).getValue();
in the incomming method this class "oracle.j2ee.ws.saaj.soap.TextImpl"
I can not explain from where it comes i didn't bind it anywhere
NOTE
1. I'am using Weblogic Server 12c
2. I search after TextImpl class in the hole server but no result
May be somebody faces already this issue?
Thanks for your help
I had similar problem when i deployed my web service into IBM WAS7.0 and tested through SOAP UI. After so much of google search i came to know the root case
"issue was that whitespace in the header was incorrectly being cast to a SOAPElement which resulted in the ClassCastException."
After removed the white space in the SOAP request, it worked.
Refer the link for more information http://www-01.ibm.com/support/docview.wss?uid=swg1PK90295
Check if there is a similar issue in WebLogic too.
I am trying to add a wsdl based webservice to my project.
the problem is that the link has spaces in it, and so netbeans says that the link syntex in wrong. "URI Syntex Error"
ip..../Local%20NPG/TELZAR/Comm%20Layer/NPG-Services.serviceagent?wsdl
I guess whitespace is replaced by "%20" in your end point url.
Modify your wsdl, replace %20 with actual whitespace. May be it work in your case.
you can find end point url in wsdl under tag
for example:
- -
I´m trying to implement a client webservice (AXIS 2 1.6.1) in JBoss 5.1.0 GA.
I´ve generated the stubs and the first invocation (to a mockService) works fine.
Now i want to invoke my web service (without the mockService) and i need to inplement the Basic-Authentication.
I already implements the basic authentication code and i´m almost sure that there isn´t a bug in the code.
HttpTransportProperties.Authenticator basicAuth = new HttpTransportProperties.Authenticator();
basicAuth.setUsername("userName");
basicAuth.setPassword("password");
basicAuth.setPreemptiveAuthentication(true);
stub._getServiceClient().getOptions().setProperty(HTTPConstants.AUTHENTICATE, basicAuth);
Since i can make a invocation using the SOAP UI, i strongly believe that my problem is that i haven´t set my
"WWS-Password Type" and "WWS TimeToLive" (i have the same error message when i disable these properties on the SOAP-UI).
I think that i may need to put a axis2.xml in the server to put these properties but...
When do i put my configuration file (in JBoss)? Or where do i define the path to this file?
Or there is something else?
Thanks all.
Note: I tried unsucessfully this solution:
Adding User/Password to SOAPHeader for WebService client call with AXIS2
My error is:
Exception in thread "main" org.apache.axis2.AxisFault: Internal Error (from server)
at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:531)
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:375)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:421)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
at myPackage.process(MyStub.java:187)
P.S- Note that the server web service communicate over https.
P.S.2 - Tks Edward
Just for the record, i´ve resolved the problem using the solution in Adding User/Password to SOAPHeader for WebService client call with AXIS2 .
I had a misspelled tag (in this case, the user tag).
Thanks a lot.
I have installed Apache Axis2 1.6.1 in a Jetty 8.0.4 web server, but JSON parsing does not seem to work, so I was wondering whether something more needs to be installed or configured in order for the receiving (service) side to understand JSON.
More specifically, I use the POJO Deployment scenario for a simple service that I have developed and, while everything works as expected with SOAP requests, when I try to use JSON I keep getting the following exception:
org.apache.axis2.AxisFault: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '{' (code 123) in prolog; expected '<' at [row,col {unknown-source}]: [1,1]
This occurs consistently as a result of using any message sending method (e.g., sendReceive() or invokeRobust()), not only with my service, but even for the unit tests (e.g., JSONIntegrationTest) bundled with Axis2.
Using packet tracing I can see that the outgoing message is correctly formatted in JSON ("application/json" content type), so, given the exception, obviously the receiving end fails to deserialize the message into the service expecting it. Apparently, Axis2 is waiting for XML even when it is receiving JSON.
How do I tell Axis2 to deserialize JSON at the receiving (service) end?
You will need to configure a JSON message builder on the server side. However, even with that it will not work because of AXIS2-5158.