You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by Alpa <aj...@cs.columbia.edu> on 2002/06/26 18:04:50 UTC
Need urgent help with serialization problem
Hi,
I have a simple .NET webservice that has 2 methods. Both methods return
a string but one takes an integer and the other takes a string.
I have written a apache soap client to access the service.
When i try to invoke the method that takes int, it works fine. BUT it
does not for the method that takes the string.
Is it a problem with the serializers? This is the fault i receive:
Fault Code = soap:Server
Fault String = Server was unable to process request. --> Object
reference not set to an instance of an object.
Could someone please help !
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
This is the code for it
import org.apache.soap.encoding.*;
import org.apache.soap.util.xml.*;
import org.apache.soap.rpc.*;
import org.apache.soap.*;
import java.util.*;
import java.net.*;
class RMT {
static String XMLSOAP = "http://schemas.xmlsoap.org/soap/encoding/";
static String __targetNS = "http://tempuri.org/";
static String __methNsURI = __targetNS;
static String __baseURL = "http://160.39.201.12/Simple/simple.asmx";
static String __soapAction = "http://tempuri.org/SimpleInput";
static String __methodName = "SimpleInput";
// static String __methodName = "SimpleMethod";
// static String __soapAction = "http://tempuri.org/SimpleMethod";
public static void main(String args[]) throws Exception {
Call call = new Call();
SOAPMappingRegistry smr = new SOAPMappingRegistry();
StringDeserializer mySer = new StringDeserializer();
smr.mapTypes(XMLSOAP, new QName(__targetNS, "SimpleInputResult"),
String.class, null, mySer);
call.setSOAPMappingRegistry(smr);
call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
call.setTargetObjectURI(__methNsURI);
call.setMethodName(__methodName);
Vector params = new Vector();
params.addElement(new Parameter("strInput", String.class, "Test",
null));
// params.addElement(new Parameter("intInput", int.class, new
Integer(555), null));
call.setParams(params);
URL url = new URL(__baseURL);
Response res = call.invoke(url, __soapAction);
if (res.generatedFault()) {
Fault f = res.getFault();
System.out.println("Fault Code = " + f.getFaultCode());
System.out.println("Fault String = " + f.getFaultString());
} else {
Parameter p = res.getReturnValue();
System.out.println(" Object Value = " + p.getValue());
}
}
}
~Alpa
Re: Need urgent help with serialization problem
Posted by Indrasish N Basuroychowdhury <in...@fanniemae.com>.
Alpa,
You have a working example for Int. Can I see that code if you do not mind.
Scott Sealy of Microsoft has a different example for sending/receiving String. If you want you can contact him.
Thanks,
Indrasish.
Alpa wrote:
> Hi,
> I have a simple .NET webservice that has 2 methods. Both methods return
> a string but one takes an integer and the other takes a string.
> I have written a apache soap client to access the service.
> When i try to invoke the method that takes int, it works fine. BUT it
> does not for the method that takes the string.
> Is it a problem with the serializers? This is the fault i receive:
>
> Fault Code = soap:Server
> Fault String = Server was unable to process request. --> Object
> reference not set to an instance of an object.
>
> Could someone please help !
>
> ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
>
> This is the code for it
>
> import org.apache.soap.encoding.*;
> import org.apache.soap.util.xml.*;
> import org.apache.soap.rpc.*;
> import org.apache.soap.*;
> import java.util.*;
> import java.net.*;
>
> class RMT {
>
> static String XMLSOAP = "http://schemas.xmlsoap.org/soap/encoding/";
> static String __targetNS = "http://tempuri.org/";
> static String __methNsURI = __targetNS;
> static String __baseURL = "http://160.39.201.12/Simple/simple.asmx";
> static String __soapAction = "http://tempuri.org/SimpleInput";
> static String __methodName = "SimpleInput";
> // static String __methodName = "SimpleMethod";
> // static String __soapAction = "http://tempuri.org/SimpleMethod";
>
> public static void main(String args[]) throws Exception {
> Call call = new Call();
> SOAPMappingRegistry smr = new SOAPMappingRegistry();
>
> StringDeserializer mySer = new StringDeserializer();
> smr.mapTypes(XMLSOAP, new QName(__targetNS, "SimpleInputResult"),
> String.class, null, mySer);
>
> call.setSOAPMappingRegistry(smr);
> call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
> call.setTargetObjectURI(__methNsURI);
> call.setMethodName(__methodName);
>
> Vector params = new Vector();
> params.addElement(new Parameter("strInput", String.class, "Test",
> null));
> // params.addElement(new Parameter("intInput", int.class, new
> Integer(555), null));
> call.setParams(params);
>
> URL url = new URL(__baseURL);
> Response res = call.invoke(url, __soapAction);
> if (res.generatedFault()) {
> Fault f = res.getFault();
> System.out.println("Fault Code = " + f.getFaultCode());
> System.out.println("Fault String = " + f.getFaultString());
> } else {
> Parameter p = res.getReturnValue();
> System.out.println(" Object Value = " + p.getValue());
> }
> }
> }
>
> ~Alpa
>
> --
> To unsubscribe, e-mail: <ma...@xml.apache.org>
> For additional commands, e-mail: <ma...@xml.apache.org>
Re: Need urgent help with serialization problem
Posted by Indrasish N Basuroychowdhury <in...@fanniemae.com>.
I keep getting this error while using the example of Alpa:
[SOAPException: faultCode=SOAP-ENV:Client; msg=No Deserializer found to deserialize a 'http://schemas.xmlsoap.org/soap/envelope/:Parameter' using encoding style
'null'.; targetException=java.lang.IllegalArgumentException: No Deserializer found to deserialize a 'http://schemas.xmlsoap.org/soap/envelope/:Parameter' using
encoding style 'null'.]
at org.apache.soap.rpc.Call.invoke(Call.java:244)
at ClientNet.main(ClientNet.java:44)
Exception in thread "main"
Can someone help me in resolving it.
Thanks,
Indrasish.
James Black wrote:
> Alpa wrote:
>
> > Fault Code = soap:Server
> > Fault String = Server was unable to process request. --> Object
> > reference not set to an instance of an object.
>
> It looks like you are not creating a string. It is null most likely. You may want to use NUnit (you can find it at sourceforge) and do some unit testing on your
> service, on the server side first.
>
> --
> To unsubscribe, e-mail: <ma...@xml.apache.org>
> For additional commands, e-mail: <ma...@xml.apache.org>
--
To unsubscribe, e-mail: <ma...@xml.apache.org>
For additional commands, e-mail: <ma...@xml.apache.org>
Re: Need urgent help with serialization problem
Posted by Indrasish N Basuroychowdhury <in...@fanniemae.com>.
I keep getting this error while using the example of Alpa:
[SOAPException: faultCode=SOAP-ENV:Client; msg=No Deserializer found to deserialize a 'http://schemas.xmlsoap.org/soap/envelope/:Parameter' using encoding style
'null'.; targetException=java.lang.IllegalArgumentException: No Deserializer found to deserialize a 'http://schemas.xmlsoap.org/soap/envelope/:Parameter' using
encoding style 'null'.]
at org.apache.soap.rpc.Call.invoke(Call.java:244)
at ClientNet.main(ClientNet.java:44)
Exception in thread "main"
Can someone help me in resolving it.
Thanks,
Indrasish.
James Black wrote:
> Alpa wrote:
>
> > Fault Code = soap:Server
> > Fault String = Server was unable to process request. --> Object
> > reference not set to an instance of an object.
>
> It looks like you are not creating a string. It is null most likely. You may want to use NUnit (you can find it at sourceforge) and do some unit testing on your
> service, on the server side first.
>
> --
> To unsubscribe, e-mail: <ma...@xml.apache.org>
> For additional commands, e-mail: <ma...@xml.apache.org>
Re: Need urgent help with serialization problem
Posted by James Black <jb...@ieee.org>.
Alpa wrote:
> Fault Code = soap:Server
> Fault String = Server was unable to process request. --> Object
> reference not set to an instance of an object.
It looks like you are not creating a string. It is null most likely. You may want to use NUnit (you can find it at sourceforge) and do some unit testing on your
service, on the server side first.
--
To unsubscribe, e-mail: <ma...@xml.apache.org>
For additional commands, e-mail: <ma...@xml.apache.org>
Re: Need urgent help with serialization problem
Posted by James Black <jb...@ieee.org>.
Alpa wrote:
> Fault Code = soap:Server
> Fault String = Server was unable to process request. --> Object
> reference not set to an instance of an object.
It looks like you are not creating a string. It is null most likely. You may want to use NUnit (you can find it at sourceforge) and do some unit testing on your
service, on the server side first.
Re: Need urgent help with serialization problem
Posted by Indrasish N Basuroychowdhury <in...@fanniemae.com>.
Alpa,
You have a working example for Int. Can I see that code if you do not mind.
Scott Sealy of Microsoft has a different example for sending/receiving String. If you want you can contact him.
Thanks,
Indrasish.
Alpa wrote:
> Hi,
> I have a simple .NET webservice that has 2 methods. Both methods return
> a string but one takes an integer and the other takes a string.
> I have written a apache soap client to access the service.
> When i try to invoke the method that takes int, it works fine. BUT it
> does not for the method that takes the string.
> Is it a problem with the serializers? This is the fault i receive:
>
> Fault Code = soap:Server
> Fault String = Server was unable to process request. --> Object
> reference not set to an instance of an object.
>
> Could someone please help !
>
> ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
>
> This is the code for it
>
> import org.apache.soap.encoding.*;
> import org.apache.soap.util.xml.*;
> import org.apache.soap.rpc.*;
> import org.apache.soap.*;
> import java.util.*;
> import java.net.*;
>
> class RMT {
>
> static String XMLSOAP = "http://schemas.xmlsoap.org/soap/encoding/";
> static String __targetNS = "http://tempuri.org/";
> static String __methNsURI = __targetNS;
> static String __baseURL = "http://160.39.201.12/Simple/simple.asmx";
> static String __soapAction = "http://tempuri.org/SimpleInput";
> static String __methodName = "SimpleInput";
> // static String __methodName = "SimpleMethod";
> // static String __soapAction = "http://tempuri.org/SimpleMethod";
>
> public static void main(String args[]) throws Exception {
> Call call = new Call();
> SOAPMappingRegistry smr = new SOAPMappingRegistry();
>
> StringDeserializer mySer = new StringDeserializer();
> smr.mapTypes(XMLSOAP, new QName(__targetNS, "SimpleInputResult"),
> String.class, null, mySer);
>
> call.setSOAPMappingRegistry(smr);
> call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
> call.setTargetObjectURI(__methNsURI);
> call.setMethodName(__methodName);
>
> Vector params = new Vector();
> params.addElement(new Parameter("strInput", String.class, "Test",
> null));
> // params.addElement(new Parameter("intInput", int.class, new
> Integer(555), null));
> call.setParams(params);
>
> URL url = new URL(__baseURL);
> Response res = call.invoke(url, __soapAction);
> if (res.generatedFault()) {
> Fault f = res.getFault();
> System.out.println("Fault Code = " + f.getFaultCode());
> System.out.println("Fault String = " + f.getFaultString());
> } else {
> Parameter p = res.getReturnValue();
> System.out.println(" Object Value = " + p.getValue());
> }
> }
> }
>
> ~Alpa
>
> --
> To unsubscribe, e-mail: <ma...@xml.apache.org>
> For additional commands, e-mail: <ma...@xml.apache.org>
--
To unsubscribe, e-mail: <ma...@xml.apache.org>
For additional commands, e-mail: <ma...@xml.apache.org>