I modified one of the samples (misc/TestClient.java). On first look It
seems to work. I am listing the code here. Is there an easy way, given
a wsdl and a method name, to generate Server Address, SOAPAction and
SOAP Message?
public static String msg = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
"<soap:Envelope
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"> " +
"<soap:Body> " +
"<CityToZipCode xmlns=\"http://ripedev.com/webservices/\"> " +
"<City>atlanta</City> " +
"</CityToZipCode> " +
"</soap:Body> " +
"</soap:Envelope>";
public static String doTest (String args[], String op) throws Exception {
Options opts = new Options( args );
String url = "http://www.ripedev.com/webservices/ZipCode.asmx";
String soapAction =
"http://ripedev.com/webservices/CityToZipCode" ;
if (op != null) soapAction = op;
args = opts.getRemainingArgs();
if ( args != null ) soapAction = args[0];
InputStream input = new ByteArrayInputStream(msg.getBytes());
Service service = new Service();
Call call = (Call) service.createCall();
SOAPEnvelope env = new SOAPEnvelope(input);
call.setTargetEndpointAddress( new URL(url) );
if (soapAction != null) {
call.setUseSOAPAction( true );
call.setSOAPActionURI( soapAction );
}
System.out.println( "Request:\n" + msg );
env = call.invoke( env );
System.out.println( "Response:\n" + env.toString() );
return( env.toString() );
}
Thanks,
Rakesh
On 4/26/05, Plorks mail <[EMAIL PROTECTED]> wrote:
>
>
> Have you found any help yet?
>
> I'm looking to do soemthing similar and very stuck
>
> >From: Rakesh Lakshminarayana <[EMAIL PROTECTED]>
> >Reply-To: Rakesh Lakshminarayana <[EMAIL PROTECTED]>
> >To: [email protected]
> >Subject: Sending SOAP Messages
> >Date: Tue, 26 Apr 2005 09:48:40 -0400
> >
> >I am looking for starting code that can send SOAP Messages using AXIS.
> >If you have any then please do share it with me at [EMAIL PROTECTED]
> > Thank You.
> >
> >Given Parameters
> >Server Address: http://www.ripedev.com/webservices/ZipCode.asmx
> >SOAPAction: http://ripedev.com/webservices/CityToZipCode
> >SOAP Message::
> ><?xml version="1.0" encoding="UTF-8"
> >standalone="no"?><SOAP-ENV:Envelope
> >xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
> >xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
> >xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
> >xmlns:s="http://www.w3.org/2001/XMLSchema"
> >xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
> >xmlns:tns="http://ripedev.com/webservices/"
> >xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
> >xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
> >xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> >xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> > ><SOAP-ENV:Body><tns:CityToZipCode
> >xmlns:tns="http://ripedev.com/webservices/"><tns:City>atlanta</tns:City></tns:CityToZipCode>
>
> _________________________________________________________________
> Be the first to hear what's new at MSN - sign up to our free newsletters!
> http://www.msn.co.uk/newsletters
>
>