Hi Sekhar,

is very simple ;o)

look at that:

---------------------------------------

import java.io.*;
import java.util.*;
import java.net.*;
import org.w3c.dom.*;
import org.apache.soap.util.xml.*;
import org.apache.soap.*;
import org.apache.soap.encoding.*;
import org.apache.soap.encoding.soapenc.*;
import org.apache.soap.rpc.*;

import org.apache.soap.transport.http.SOAPHTTPConnection;

public class testClient {

     public static void main(String[] args) throws Exception {


          //the URL of the Web Service ************************************
          URL mUrl = new URL ("http://localhost/webs/myweb/myweb2.asmx";);
          //**************************************************************


          SOAPMappingRegistry smr = new SOAPMappingRegistry ();
          StringDeserializer sd = new StringDeserializer ();
          smr.mapTypes (Constants.NS_URI_SOAP_ENC,    new QName ("",
"Result"), null, null, sd);

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

          // build the call.
          Call call = new Call ();
          call.setSOAPTransport(st);
          call.setSOAPMappingRegistry (smr);



          //RequestNamespace Binding with SOAP (namespace for INPUT )
********
          call.setTargetObjectURI ("urn:xGetStoreInfoRequest");

          //Method name
***********************************************************
          call.setMethodName("GetStoreInfo");

//************************************************************************


          call.setEncodingStyleURI
("http://schemas.xmlsoap.org/soap/encoding/";);

          Vector params = new Vector();

          //Parameter - for each parameters, you have to make a AddElement

//*************************************************************************
          params.addElement(new Parameter("id", String.class, "7099",
null));


//*************************************************************************


          call.setParams(params);

          Response resp = null;
          try
          {

          //call.invoke("URL of the web service", "URI of the method")

//*****************************************************************
            resp = call.invoke(mUrl, "urn:xGetStoreInfo");

//*****************************************************************

          }
          catch (SOAPException e) {
               System.err.println("Caught SOAPException (" + e.getFaultCode
() + "): " + e.getMessage ());
               return;
          }

          // check response
          if (resp != null && !resp.generatedFault()) {
             Parameter ret = resp.getReturnValue();
            Object value = ret.getValue();

            System.out.println ("Answer--> " + value);
          }
          else {
               Fault fault = resp.getFault ();
               System.err.println ("Generated fault: ");
               System.out.println (" Fault Code = " + fault.getFaultCode
());
               System.out.println (" Fault String = " +
fault.getFaultString());
          }
     }
}



-----------------


It works fine (you onlay use a string).
I want to use a structur. This cause a deserialization problem.

Anybody now this?

greets

Hoang




                                                                                       
                                    
                    "Sekhar Nadella"                                                   
                                    
                    <shaker_nadella@maste        To:     [EMAIL PROTECTED]      
                                    
                    rcard.com>                   cc:                                   
                                    
                                                 Subject:     SOAP question?           
                                    
                    22.08.2001 20:30                                                   
                                    
                    Please respond to                                                  
                                    
                    soap-user                                                          
                                    
                                                                                       
                                    
                                                                                       
                                    




Hi,

Can anybody tell me how to write a .NET client for java based (apache/soap)
webservice running on websphere?
I'll appreciate you help.
Thanks in advance.

Thanks & Regards,
Sekhar Nadella






Reply via email to