xml-soap-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alpa <ajs...@cs.columbia.edu>
Subject Need urgent help with serialization problem
Date Wed, 26 Jun 2002 16:04:50 GMT
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:   <mailto:soap-user-unsubscribe@xml.apache.org>
For additional commands, e-mail: <mailto:soap-user-help@xml.apache.org>


Mime
View raw message