I'm less than a beginner in Java (I'm a .NET developer), but i have to fix a Java error when invoking a WebMethod through a proxy class.
From .NET, I can call it with no problems, but in Java, this is what happens:
java.lang.IllegalArgumentException
at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)
at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)
at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
at weblogic.apache.xerces.parsers.SAXParser.endElement(SAXParser.java:1411)
at weblogic.apache.xerces.validators.common.XMLValidator.callEndElement(XMLValidator.java:1613)
at weblogic.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:1174)
at weblogic.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:399)
at weblogic.apache.xerces.framework.XMLParser.parse(XMLParser.java:1147)
at weblogic.xml.jaxp.WebLogicXMLReader.parse(WebLogicXMLReader.java:135)
at weblogic.xml.jaxp.RegistryXMLReader.parse(RegistryXMLReader.java:147)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
at org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.java:796)
at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:144)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:2443)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at com.verizon.vmw.csgw.ws.updateDOJob.v4_4.wsdl.UpdateDOJobServiceSoapBindingStub.updateDOJob(UpdateDOJobServiceSoapBindingStub.java:206)
at com.verizon.vmw.csgw.ws.updateDOJob.v4_4.wsdl.UpdateDOJobServiceProxy.updateDOJob(UpdateDOJobServiceProxy.java:50)
at rm.interfaces.wfadosnd.WfaDoSndWorker.updateDOJobComments(WfaDoSndWorker.java:1111)
at rm.interfaces.wfadosnd.WfaDoSndWorker.checkEtaAsgn(WfaDoSndWorker.java:507)
at rm.interfaces.wfadosnd.WfaDoSndWorker.resequenceDODispatches(WfaDoSndWorker.java:541)
at rm.interfaces.wfadosnd.WfaDoSndWorker.processOutboundRows(WfaDoSndWorker.java:283)
at rm.interfaces.wfadosnd.WfaDoSndWorker.run(WfaDoSndWorker.java:112)
at rm.util.WorkerThread.run(ThreadPool.java:152)
Does anyone have any idea of what could be causing this exception?
Check with Wireshark what goes over the wire and diff the .NET request with the java request.
Looks like your web application was receiving a message, and one of its fields failed verification that it was the right type (or acceptable value).
Whether that was a data issue, or a coding issue depends heavily on the data, code, and intent which are all not provided.
As you can see from the class names in the stack trace, the exception is thrown during deserialization of the webservice response.
The exception itself is pretty generic and hence carries little useful information.
Try looking at the response sent over the wire, or set an exception breakpoint in eclipse so you can inspect the stack frames the exception is thrown to get additional context. (To ease interpretation of what went wrong, you'll probably want to procure the source code of your web service stack).
look in the code for something is parsed for user input
like this Integer i = Integer.parseInt("string");
and the "string" contains none valid number
Related
I need to consume a SOAP webservice with two endpoints
Employee
Customer
Both the endpoints have same function "getAddress" which returns list of Strings.
In order to consume the web service, I have used "wsimport" tool to generate the stubs
and apache cxf library, I get an exception
Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Fault occurred while processing.
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:156)
at com.sun.proxy.$Proxy39.getAddress(Unknown Source)
at com.testwebservice.Main.main(Main.java:105)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
Caused by: org.apache.cxf.binding.soap.SoapFault: Fault occurred while processing.
at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.unmarshalFault(Soap11FaultInInterceptor.java:75)
at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:46)
at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:35)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262)
at org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:113)
at org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor.handleMessage(CheckFaultInterceptor.java:69)
at org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor.handleMessage(CheckFaultInterceptor.java:34)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262)
at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:798)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1656)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1521)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1429)
at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:659)
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:532)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:464)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:367)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:320)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:89)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:134)
when ever I tried to use the "Employee.getAddress" method
But before, I would like to clarify whether two end points can have a same function name with same return type ?
Could not find any information in the documentation.
about your second question:
you cant have a same function name. actually you cant even have overloading. Because WSDL does not support method overloading(not OOPs). WCF generates WSDL which specifies the location of the service and the operation or methods the service exposes.
please provide more information about your service(Like WSDL file) so we can help you with details.
I have a java application (A) that calls the webservice.
1)Then I have another app (B) that uses the A jar.
The call is successful and needed data are returned.
2)Then I have web application that also uses the A jar.
In this case when the web service method is called from A app, an exception is thrown.
Since the class that executes the webservice call is the same in both cases, I'm not sure where the problem is.
The webservice is on https server. But I authenticate using credentials.
I think maybe something should be set in the web application, but I don't know what..
The exception is:
09:21:48.009 [http-nio-8084-exec-33] WARN o.a.cxf.phase.PhaseInterceptorChain - Interceptor for {http://www.myserver.com/ci}ci2#{http://www.myserver.com/ci}GetCertPath has thrown exception, unwinding now
java.lang.UnsupportedOperationException: null
at java.util.AbstractMap.put(AbstractMap.java:209) ~[na:1.8.0_92]
at org.apache.cxf.binding.soap.interceptor.SoapPreProtocolOutInterceptor.setSoapAction(SoapPreProtocolOutInterceptor.java:122) ~[cxf-rt-bindings-soap-2.7.16.jar:2.7.16]
javax.xml.ws.soap.SOAPFaultException: Fault string, and possibly fault code, not set
at org.apache.cxf.binding.soap.interceptor.SoapPreProtocolOutInterceptor.handleMessage(SoapPreProtocolOutInterceptor.java:63) ~[cxf-rt-bindings-soap-2.7.16.jar:2.7.16]
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:158)
at org.apache.cxf.binding.soap.interceptor.SoapPreProtocolOutInterceptor.handleMessage(SoapPreProtocolOutInterceptor.java:47) ~[cxf-rt-bindings-soap-2.7.16.jar:2.7.16]
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272) ~[cxf-api-2.7.16.jar:2.7.16]
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:572) [cxf-api-2.7.16.jar:2.7.16]
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:481) [cxf-api-2.7.16.jar:2.7.16]
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:382) [cxf-api-2.7.16.jar:2.7.16]
at com.sun.proxy.$Proxy318.getCertPath(Unknown Source)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:335) [cxf-api-2.7.16.jar:2.7.16]
..... more lines here :) .....
at java.util.AbstractMap.put(AbstractMap.java:209)
at org.apache.cxf.binding.soap.interceptor.SoapPreProtocolOutInterceptor.setSoapAction(SoapPreProtocolOutInterceptor.java:122)
at org.apache.cxf.binding.soap.interceptor.SoapPreProtocolOutInterceptor.handleMessage(SoapPreProtocolOutInterceptor.java:63)
Fault string, and possibly fault code, not set
at org.apache.cxf.binding.soap.interceptor.SoapPreProtocolOutInterceptor.handleMessage(SoapPreProtocolOutInterceptor.java:47)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:572)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:481)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:382)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:335)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:136)
... 59 more
Any ideas?
Thank you.
EDIT:
Does it have to have any headers set? When connecting in case 1, there is nothing specific set and it's working.
Ok, so I have found the issue. The request should have included the content-type. Which is strange that it didn't threw an exception in the first case...
I have added Content-Type: application/soap+xml; charset=utf-8 and the web application is working too.
As I found out the javax.xml.ws.soap.SOAPFaultException: Fault string, and possibly fault code, not set is mostly connected to missing content-type..
In my case, this was due to a simple badly formatted URL in a placeholder. http:/xxx.yyu (note the single /)
CXF wasn't very clear running in JDK6 but running in JDK8 was more explicit
I am using jdk1.7_60 and apache tomcat
I deployed my web application I got following error
java.security.NoSuchAlgorithmException: algorithm RSA/PKCS1 is not available from provider Cryptix
at xjava.security.IJCE.getClassCandidate(IJCE.java:463)
at xjava.security.IJCE.getImplementationClass(IJCE.java:416)
at xjava.security.IJCE.getImplementation(IJCE.java:373)
at xjava.security.Cipher.getInstance(Cipher.java:492)
at xjava.security.Cipher.getInstance(Cipher.java:455)
at COM.claymoresystems.ptls.SSLClientKeyExchange.encode(SSLClientKeyExchange.java:77)
at COM.claymoresystems.ptls.SSLHandshake.sendHandshakeMsg(SSLHandshake.java:149)
at COM.claymoresystems.ptls.SSLHandshake.sendHandshakeMsg(SSLHandshake.java:144)
at COM.claymoresystems.ptls.SSLHandshakeClient.sendClientKeyExchange(SSLHandshakeClient.java:400)
at COM.claymoresystems.ptls.SSLHandshakeClient.processTokens(SSLHandshakeClient.java:148)
at COM.claymoresystems.ptls.SSLHandshake.processHandshake(SSLHandshake.java:135)
at org.globus.gsi.gssapi.GlobusGSSContextImpl.initSecContext(GlobusGSSContextImpl.java:483)
at org.globus.gsi.gssapi.net.GssSocket.authenticateClient(GssSocket.java:102)
at org.globus.gsi.gssapi.net.GssSocket.startHandshake(GssSocket.java:140)
at org.globus.gsi.gssapi.net.GssSocket.getOutputStream(GssSocket.java:161)
at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:433)
at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:135)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
at org.apache.axis.client.Call.invokeEngine(Call.java:2745)
at org.apache.axis.client.Call.invoke(Call.java:2728)
at org.apache.axis.client.Call.invoke(Call.java:2405)
at org.apache.axis.client.Call.invoke(Call.java:2327)
at org.apache.axis.client.Call.invoke(Call.java:1767)
at org.nimbustools.messaging.gt4_0.generated.WorkspaceFactoryPortTypeSOAPBindingStub.create(WorkspaceFactoryPortTypeSOAPBindingStub.java:1224)
at org.globus.workspace.client_core.actions.Create.createImpl(Create.java:575)
at org.globus.workspace.client_core.actions.Create.create(Create.java:497)
Please help me how to solve this problem.
Thanks in advance. Its very important issue to fix.
Thanks
kalasagar
it's not able to find algorithm if you give it like RSA/PKCS1.You need to specify whether you want to use mode or not .Try with RSA/None/PKCS1Padding
I am developing a web application in STS. In it a webservice is to be called and the results are to be shown.I generated the web service clients from wsdl using STS itself.
I created a sample java file that sends a request to this web service and returns the results.The following is the code:
public final class Client {
static Answer answerObj;
private Client() {
}
public static Answer webCall() throws Exception {
// START SNIPPET: client
Question questionObj = new Question();
questionObj.setName("t");
questionObj.setNameStartsWith(true);
questionObj.setDistrict("kob");
questionObj.setHouseNo("0");
questionObj.setPhone("0");
questionObj.setStreet("hai");
questionObj.setStreetStartsWith(false);
//questionObj.setAccountantName("")
questionObj.setCvrNo(1);
//questionObj.setDistrict("Soendergade 2C ");
//Like this set all the values here .
/*System.getProperties().put("proxySet", "true");
System.getProperties().put("https.proxyHost", "");
System.getProperties().put("https.proxyPort",80 );*/
answerObj =nne_PortTypeProxyObj.search(questionObj, 10, 10, 0, "");
System.out.println(answerObj.getCompanyBasic().length);
return answerObj;
// END SNIPPET: client
}
}
Now my problem is that, when i call the method search in the web service, the following exception occurs:
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Client
faultSubcode:
faultString: caught exception while handling request: deserialization error: java.lang.NumberFormatException: For input string: ""
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:caught exception while handling request: deserialization error: java.lang.NumberFormatException: For input string: ""
at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)
at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)
at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:601)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1774)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2930)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:395)
at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
at org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.java:796)
at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:144)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:2443)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at net.stibo.com.nne._3_1.PortTypeBindingStub.search(PortTypeBindingStub.java:1446)
at net.stibo.com.nne._3_1PortTypeProxy.search(PortTypeProxy.java:188)
at com.sapienter.jbilling.server.util.Client.webCall(Client.java:51)
at com.sapienter.jbilling.server.util.Client$webCall.call(Unknown Source)
I searched for the same in stackoverflow and found this:
multiRef in generated xml sending by WS
I think this is the problem because i tried various parameters with search method.But there is no good solution found for this. Can anyone help me?PLZZZ help....
I don't know what's the problem with the AXIS generated stubs.But I overcomed the situation by using java SAAJ library by framing request as needed by the webservice as in the link:
Working Soap client example
I get this error when I use my autogenerated ServiceBindingStub.java. WebService side is working ok, so this error must be in code, but code is autogenerated, so I cannot know why it doesn't work. Some other calls work fine, but this doesn't. This call included updating, while other working calls are just fetching data from WebService.
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: org.xml.sax.SAXParseException: Premature end of file.
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:org.xml.sax.SAXParseException: Premature end of file.
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:2443)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
This happens when service you are connecting to does not return SOAP response, but some text or HTML. Try opening the URL in the browser or use some SOAP debugger like SOAP UI to see what is returned from the service.
I once had the same problem. In my case, I received messages with 'binary data' between tags (imagery). Axis used a fixed size buffer to read the data, once the buffer was full it just proceeded and ran out of sync.
In fact, you should be able to find the tag or part in the xml file by debugging the stub code step by step. No guarantee, that the issue will can be solved easily but it might give you a hint that the (a) stub is not generated correctly or (b) the xml file is just not well-formed or valid against the schema that has been used to generate the stub.
Good luck! (I didn't solve my issue..)
I just had (and solved) this problem, following Superfilin's answer. In the end, the problem turned out to be that I hadn't added a <beanMapping> for one of the classes I was returning in my deployment.wsdd file. Any time the response would have included that class, I'd get a completely empty message body instead.
Even we have faced the same issue. But there are some special characters in the content. We removed those special characters and it worked fine.