Meaningless Drivel is fun!*
The moose likes Web Services and the fly likes null pointer exception when getting SOAP response for a webservice Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "null pointer exception when getting SOAP response for a webservice " Watch "null pointer exception when getting SOAP response for a webservice " New topic
Author

null pointer exception when getting SOAP response for a webservice

mast shaikh
Greenhorn

Joined: Mar 12, 2012
Posts: 1
currently i am using apache SOAP-2.3.1.jar (web services deployed on weblogic 10.1 server)to test the web services .But i am getting following exception when testing the web service.

Exception in thread "main" java.lang.NullPointerException
at org.apache.soap.transport.TransportMessage.read(TransportMessage.java:206)
at org.apache.soap.util.net.HTTPUtils.post(HTTPUtils.java:382)
at org.apache.soap.transport.http.SOAPHTTPConnection.send(SOAPHTTPConnection.j \
ava:309) at org.apache.soap.rpc.Call.invoke(Call.java:248)


When i debugged ,then came to know that server is not sending the Content type so its thorwing the null pointer exception.
is it a bug in the apache SOAP-2.3.1 jar .

Please let me know the how to resolve the isssue.

code i am using...

// create the transport and set parameters
SOAPHTTPConnection st = new SOAPHTTPConnection();
st.setMaintainSession(true);

// build the call.
Call call = new Call();
call.setSOAPTransport(st);
call.setTargetObjectURI("urn:TransferService");
call.setMethodName("getData");
call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);


Vector params = new Vector();

params.addElement(new Parameter("requestXml", String.class, downloadListXml, null));

call.setParams(params);
// invoke it
System.out.println("Invoking web service ");
Response resp;

SOAPMappingRegistry smr = call.getSOAPMappingRegistry();
SOAPContext reqCtx = call.getSOAPContext();
Envelope callEnv = call.buildEnvelope();
StringWriter payloadSW = new StringWriter();
callEnv.marshall(payloadSW, smr, reqCtx);
reqCtx.setRootPart(payloadSW.toString(),
Constants.HEADERVAL_CONTENT_TYPE);
System.out.println("Invoking web service -->>>"+reqCtx.getContentType());

System.out.println("First Call");

st.setUserName(username);
st.setPassword(password);
System.out.println("Second Call");

resp = call.invoke(url,null); ---->>> here getting the isssue.

 
Don't get me started about those stupid light bulbs.
 
subject: null pointer exception when getting SOAP response for a webservice
 
Similar Threads
whats wrong with this ??? ASP.NET service and Java Client
RPC SOAP Client in Javascript
get Soap service return valus and EnvelopeString
problem with SOAP
internal method call.getEnvelopeString() fails. unable to identify cause of failure