I have a requirement where I call a SOAP based web service from Java using Axis2 from eclipse. The web service code is in C#, with a BasicHttpBinding.
But when I call the method from the client stub I get this error.
org.apache.axis2.AxisFault: Object reference not set to an instance of an object.
Could anyone help me figure out this one? Is this on the service side or on the client side? Previously I got 'Internal Server error' and then they had to add something so that I can see this error in the logs.
The message is from the C# web service side ("Object reference not set to an instance of an object" is basically a Java equivalent of NullPointerException) but it might be because of something you send from your Java client or maybe you don't send.
The error usually means that you didn't send a required parameter and that the web service didn't do a proper job of validating it's input and missing parameter got to a point when caused the NullReferenceException.
But there is only one way to be sure, and that is to troubleshoot the call.
I suggest you use something like SoapUI to create a message and send that to the service. Once you get a succesfull call in SoapUI, make a call with the same parameters from your Java client and see what happens. When you do that, using a proxy for logging is very useful to see if the sent message is actually the expected one.
Related
For one my client i am fixing one security issue where a hacker is changing request method from POST to GET. Can anyone tell me how I can detect such scenario on server side?
Server needs to serve both GET and POST requests but it needs to restrict those GETs which are originally POST and were converted to GETby hacker.
I have a web service client written in java. There is a change in WSDL in the server side due to an extra field that is added to an existing complex type field. But my client side has the stale WSDL which does not know this field, so when there is a web service call there is a SAX Exception due to that missing field. Is there anything I can do in my client side to get the other elements? Ignore that one element that is not conforming to the client code that I'm having?
EDIT : Normally when there is a change with WSDL, that should be communicated to client side, but when the change is not communicated in some situations, the system should be kept afloat. Hence the need for the work around.
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'm trying to get a Java Client to communicate with a WCF wshttpbinding WebService. But I've been unsucesful so far. The call either hangs, or I get: “SOAPFaultException: The message could not be processed. This is most likely because the action 'http://tempuri.org/ISampleService/GetServiceName' is incorrect or because the message contains an invalid or expired security context token or because there is a mismatch between bindings. The security context token would be invalid if the service aborted the channel due to inactivity. To prevent the service from aborting idle sessions prematurely increase the Receive timeout on the service endpoint's binding.”
My Web Service is just the default Visual Studio 2010 generated "WCF Service Library Template".
My java client is generated in netBeans 7.0.1 and stubs have been generated using new Other --> Web Services --> Web Service Client and I’m referencing a local WSDL.
I've tried adding WebServiceFeature wsAddressing = new AddressingFeature(true); in the stub generated but it just throws the exception above.
I see other people with similar problems; however, I don't see any true resolution. Any suggestions would be greatly appreciated.
It sounds like you have a soap formatting issue. The java client isn't generating soap XML that makes sense to the WCF service. To get an idea of what the soap XML the service is expecting use the WcfTestClient command line app to call the service. This app dynamically creates a service proxy in a WinForm app. In the app, call the service operation and click the XML tab (next to the Formatted tab at the bottom of the right pane). You'll see both the request & response soap in this tab.
Next, configure the WCF service for message tracing and call it from the java client to see the soap XML it is being sent. Now you can compare the two soap messages to see what is different. The java client will need be configured to generate the soap format the WCF is expecting.
The WCF team recently released some WCF interop bindings specifically for java. These may not apply to your specific situation but they're probably worth reviewing.
I'm having a problem with the XML-RPC communication.
I have a XML-RPC Client made in Java with Apache XmlRpc and a XML-RPC Server made in PHP with PEAR's XML_RPC. The problem is that i get a "HTTP server returned unexpected status: Not Found" error. I tested the server with a PEAR XML-RPC Client and it works. I don't know what is the problem because i can't print the response of the server (i don't know how), but it seems that the authentication works, because if i don't input the correct username and passoword i get an authentication error.
Please help!
Thanks in advance.
Cristian
Start debugging, here some information from the PEAR XML_RPC documention:
setDebug()
$client->setDebug ( $debugOn )
$debugOn is either 0 or 1 depending on
whether you require the client to
print debugging information to the
browser. The default is not to output
this information.
The debugging information includes the
raw data returned from the XML-RPC
server it was querying, and the PHP
value the client attempts to create to
represent the value returned by the
server. This option can be very useful
when debugging servers as it allows
you to see exactly what the server
returns.
Source: http://pear.php.net/manual/en/package.webservices.xml-rpc.api.php
Make sure you are taking into account the package name with writing the interface stub in java, because by default it will tack that onto the from of the method it is trying to reference.