I guess u r trying to access a remote method, which accepts a parameter. If
I am wrong, please ignore my mail.
SOAPEnvelope env = new SOAPEnvelope();
Object[] paramValue = new Object[]{"myMessage"};
RPCElement re = new RPCElement("http://tempuri.org",
"testMethod", paramValues);
env.addBodyElement(re);
call.invoke();
The above lines should solve your problem. But the testMethod, you have,
should be modified to
public String testMethod(String myMessage)
{
// ? what to do here to retrieve the value of the message?
return "Hi, you've reached the testMethod. An ur message -
"+myMessage;
}
Thanks & regards,
Ayyappan Gandhirajan
----------------------------------------
Senior Software Engineer,
NSP BU,
HP Services - Offshore,
Office: 91.80.225.1554 Ext 1472
Direct: 91.80.205.1472
Telnet: 847.1472
Mobile: 91.94483.14969
E-Mail: [EMAIL PROTECTED]
----------------------------------------
-----Original Message-----
From: Lee, Insoo [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 11, 2004 11:19 PM
To: '[EMAIL PROTECTED]'
Subject: call.invoke( env ) - how to pass parameters?
Hi,
Please help me with my newbie question.
I'm doing call.invoke( env ) where env is Axis's SOAPEnvelope and I'm trying
to find a way to pass a parameter to the server and still use call.invoke(
env )
I need to use call.invoke and since I have to sign/encrypt the SOAPEnvelope
eventually.
Client:
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(new java.net.URL(opts.getURL()));
SOAPEnvelope env = new SOAPEnvelope();
SOAPBodyElement sbe = new
SOAPBodyElement(XMLUtils.StringToElement("http://localhost:8080/LogTestServi
ce",
"testMethod", "myMessage"));
env.addBodyElement( sbe );
call.invoke(env);
This sample code would generate a SOAP message that looks like
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<ns1:testMethod xmlns:ns1="http://localhost:8080/LogTestService">
myMessage </ns1:testMethod>
</soapenv:Body>
</soapenv:Envelope>
>From the server side, testMethod gets invoked correctly, but how would I
retrieve the value of this element - my Message?
public String testMethod()
{
// ? what to do here to retrieve the value of the message?
return "Hi, you've reached the testMethod.";
}
Thanks for your time!
Lee