You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Doug Schaible <do...@gmail.com> on 2007/05/24 20:09:59 UTC
Axis 1 to Axis 2
Good afternoon!
Can anyone tell me what the code below would look like in Axis2? I need to
create a SOAP client in Axis 2 that allows me to pass the payload and one
that allows me to pass the entire message. I understand that I should use
the operation client interface and the service client interface, but I can
not find an example of using those two without first generating stubs with
wsdl2java. I can not use wsdl2java.
Thanks,
Doug
//create new service to be able to use for call
Service service = new Service();
Call call = (Call) service.createCall();
//set the properties for using the SOAPaction
call.setProperty(Call.SOAPACTION_USE_PROPERTY, Boolean.TRUE);
call.setProperty(Call.SOAPACTION_URI_PROPERTY, SOAPaction);
//set the endpoint url
call.setTargetEndpointAddress( new java.net.URL(endpointUrl) );
//add SOAP elements
SOAPBodyElement[] input = new SOAPBodyElement[1];
Element inputQuery = doc.getDocumentElement();
input[0] = new SOAPBodyElement(inputQuery);
result = (String) call.invoke( input );
Re: Axis 1 to Axis 2
Posted by Paul Fremantle <pz...@gmail.com>.
Doug
> Service service = new Service();
> Call call = (Call) service.createCall();
ServiceClient sc = new ServiceClient();
> //set the properties for using the SOAPaction
> call.setProperty(Call.SOAPACTION_USE_PROPERTY, Boolean.TRUE);
> call.setProperty(Call.SOAPACTION_URI_PROPERTY, SOAPaction);
sc.getOptions().setAction(SOAPAction);
> //set the endpoint url
> call.setTargetEndpointAddress( new java.net.URL(endpointUrl) );
sc.setTargetEPR(new EndpointReference(endpointUrl));
> //add SOAP elements
> SOAPBodyElement[] input = new SOAPBodyElement[1];
>
> Element inputQuery = doc.getDocumentElement();
>
> input[0] = new SOAPBodyElement(inputQuery);
>
OMElement el = // here you have to create an OMElement!
> result = (String) call.invoke( input );
OMElement result = sc.sendReceive(el);
The OMElement interface is similar to DOM. If you are creating by hand
using DOM APIs it might be worth porting over to OM. There is also a
DOM over OM implementation called DOOM if you have a lot of DOM code.
Paul
On 5/24/07, Doug Schaible <do...@gmail.com> wrote:
> Good afternoon!
>
> Can anyone tell me what the code below would look like in Axis2? I need to
> create a SOAP client in Axis 2 that allows me to pass the payload and one
> that allows me to pass the entire message. I understand that I should use
> the operation client interface and the service client interface, but I can
> not find an example of using those two without first generating stubs with
> wsdl2java. I can not use wsdl2java.
>
> Thanks,
> Doug
>
>
>
>
>
> //create new service to be able to use for call
> Service service = new Service();
> Call call = (Call) service.createCall();
>
> //set the properties for using the SOAPaction
> call.setProperty(Call.SOAPACTION_USE_PROPERTY, Boolean.TRUE);
> call.setProperty(Call.SOAPACTION_URI_PROPERTY, SOAPaction);
>
> //set the endpoint url
> call.setTargetEndpointAddress( new java.net.URL(endpointUrl) );
>
> //add SOAP elements
> SOAPBodyElement[] input = new SOAPBodyElement[1];
>
> Element inputQuery = doc.getDocumentElement();
>
> input[0] = new SOAPBodyElement(inputQuery);
>
> result = (String) call.invoke( input );
--
Paul Fremantle
Co-Founder and VP of Technical Sales, WSO2
OASIS WS-RX TC Co-chair
blog: http://pzf.fremantle.org
paul@wso2.com
"Oxygenating the Web Service Platform", www.wso2.com
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
Re: Axis 1 to Axis 2
Posted by Davanum Srinivas <da...@gmail.com>.
Please see samples\quickstartaxiom sample in Axis2 1.2 zip file.
thanks,
dims
On 5/24/07, Doug Schaible <do...@gmail.com> wrote:
> Good afternoon!
>
> Can anyone tell me what the code below would look like in Axis2? I need to
> create a SOAP client in Axis 2 that allows me to pass the payload and one
> that allows me to pass the entire message. I understand that I should use
> the operation client interface and the service client interface, but I can
> not find an example of using those two without first generating stubs with
> wsdl2java. I can not use wsdl2java.
>
> Thanks,
> Doug
>
>
>
>
>
> //create new service to be able to use for call
> Service service = new Service();
> Call call = (Call) service.createCall();
>
> //set the properties for using the SOAPaction
> call.setProperty(Call.SOAPACTION_USE_PROPERTY, Boolean.TRUE);
> call.setProperty(Call.SOAPACTION_URI_PROPERTY, SOAPaction);
>
> //set the endpoint url
> call.setTargetEndpointAddress( new java.net.URL(endpointUrl) );
>
> //add SOAP elements
> SOAPBodyElement[] input = new SOAPBodyElement[1];
>
> Element inputQuery = doc.getDocumentElement();
>
> input[0] = new SOAPBodyElement(inputQuery);
>
> result = (String) call.invoke( input );
--
Davanum Srinivas :: http://davanum.wordpress.com
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org