Loading ...
Sorry, an error occurred while loading the content.

Problem with calling .net service from java

Expand Messages
  • amal tolba
    Hello all, I am trying to call a MS .NET service from a java class. I tried different services but i always get a run time error. I get two different runtime
    Message 1 of 1 , Dec 18, 2002
    • 0 Attachment
      Hello all,
      I am trying to call a MS .NET service from a java class. I tried different services but i always get a run time error.
      I get two different runtime errors when i run different services. the two errors are:
       
      1. no deserializer fount to deserialize.....
      2. i get an empty response that causes a java.nullpointer exception
       
      I get the first error more frequently i only got ther second one once
       
      I provided my code below in case you want to look at it, Thanks a lot.
      //////////////////////////////
      import java.util.*;
      import java.lang.*;
      import java.io.*;
      import java.*;
      import java.net.*;
      import org.apache.soap.util.xml.*;
      import org.apache.soap.encoding.soapenc.BeanSerializer;
      import org.apache.soap.encoding.*;
      import org.apache.soap.*;
      import org.apache.soap.rpc.*;
      /////////////////////////////////
      class NET
      {
      public static void main(String[] args)
      {
       try
       {

        Call call = new Call ();
        call.setEncodingStyleURI("http://schemas.xmlsoap.org/soap/encoding/");
        call.setTargetObjectURI ("s0:ZipCodes");
       call.setMethodName ("rtnZipInfoCSV");
       Vector params = new Vector ();
        file://SOAPMappingRegistry smr = new SOAPMappingRegistry();
       params.addElement (new Parameter("zip_IN",String.class,"10010" ,null));
       file://params.addElement (new Parameter("paramIntLevel", String.class, "0",Constants.NS_URI_SOAP_ENC));
       call.setParams (params);
        System.out.println("######B4 CALL######");
        file://QName QN= new QName();
        System.out.println("######here######");
        file://QN.setNamespaceURI("http://schemas.xmlsoap.org/soap/encoding/");
        file://smr.mapTypes("http://schemas.xmlsoap.org/soap/encoding/",QN,String.class,smr.querySerializer(String.class,"http://schemas.xmlsoap.org/soap/encoding/"),null);
        System.out.println("######here######");
         Response resp=call.invoke(new URL("http://services.pagedownweb.com/ZipCodes.asmx"), "http://services.pagedownweb.com/rtnZipInfoCSV") ;
        System.out.println(resp);
         System.out.println("######AFTER CALL######");
        if (resp.generatedFault ())
       {
        Fault fault = resp.getFault ();
        System.out.println ("Something is wrong");
        System.out.println ("  Fault Code   = " + fault.getFaultCode ());
        System.out.println ("  Fault String = " + fault.getFaultString ()); }
        else
        {
         Parameter result = resp.getReturnValue ();
          System.out.println (result.getValue ());
        }
       }
       catch (Exception e)
       {
        System.out.println ("********Exception*******");
        System.out.println (e);
       }
      }
      }
       


      Add photos to your messages with MSN 8. Get 2 months FREE*.
    Your message has been successfully submitted and would be delivered to recipients shortly.