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 Prateek Asthana <pa...@gmail.com> on 2010/11/08 13:14:56 UTC

Usage of Options.setSoapVersionURI() to get SOAP1.2

Hi,

I am trying to make my client use SOAP 1.2 but it always using the
SOAP 1.1. Below are more details Can someone please let me know the
use/intention of Options.setSoapVersionURI().

For the below client code:

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

		try {
			Options options = new Options();
			EndpointReference endpointReference = new EndpointReference(
					"http://localhost:8888/axis2/services/TemperatureConverter");
			options.setTo(endpointReference);
			options.setSoapVersionURI("http://www.w3.org/2003/05/soap");
			options.setAction("urn:c2f");

			ServiceClient client = new ServiceClient();
			client.setOptions(options);

			OMElement request = createRequest();
			OMElement response = client.sendReceive(request);
			
			System.out.println("Request:  " + request);
			System.out.println("Response: " + response);

		} catch (AxisFault e) {
			e.printStackTrace();
		}

	}


I get the following SOAP envelope (using tcpmon):
POST /axis2/services/TemperatureConverter HTTP/1.1
Content-Type: text/xml; charset=UTF-8
SOAPAction: "urn:anonOutInOp"
User-Agent: Axis2
Host: 127.0.0.1:8888
Transfer-Encoding: chunked

102
<?xml version='1.0' encoding='UTF-8'?>
   <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
      <soapenv:Body>
         <ns1:c2f xmlns:ns1="http://temperature.training.wso2.com">
            <ns1:cTemp>120.0</ns1:cTemp>
         </ns1:c2f>
      </soapenv:Body>
   </soapenv:Envelope>0

I replaced options.setSoapVersionURI("http://www.w3.org/2003/05/soap") with
options.setSoapVersionURI("http://schemas.xmlsoap.org/wsdl/soap12/")
but to no avail.

I am aware that by using ServiceClient client = new
ServiceClient(context,....) I can get
a SOAP1.2 envelope. But I am wondering how use SOAP1.2 with
ServiceClient client = new ServiceClient()
and more importantly what is the use/intention of Options.setSoapVersionURI().

Thanks,
Prateek

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org


Re: Usage of Options.setSoapVersionURI() to get SOAP1.2

Posted by Prateek Asthana <pa...@gmail.com>.
Josef,
Please see below for answers:

> What if your server supports both SOAP protocols 1.1 and 1.2?
I am not too sure if it matters what the server supports as the below
o/p is captured using tpcmon. If the server has any issue with client
trying SOAP 1.2 while the server does not support it, then it can
throw an exception.

> Would then your client need to say which protocol shall be used actually?
I was trying to understand the use of SoapVersionURI.

> What if your server allows to bind only to one SOAP 1.1 protocol?
Again..same answer as the first one. By the way, server supports both
SOAP1.1 and 1.2.

Thanks,
Prateek

On Mon, Nov 8, 2010 at 8:30 AM, Stadelmann Josef
<jo...@axa-winterthur.ch> wrote:
> Allow me 3 questions:
>
> What if your server supports both SOAP protocols 1.1 and 1.2?
>
> Would then your client need to say which protocol shall be used actually?
>
> What if your server allows to bind only to one SOAP 1.1 protocol?
>
> Josef
>
>
>
> -----Ursprüngliche Nachricht-----
> Von: Prateek Asthana [mailto:paryanz@gmail.com]
> Gesendet: Montag, 8. November 2010 13:15
> An: java-user@axis.apache.org
> Betreff: Usage of Options.setSoapVersionURI() to get SOAP1.2
>
> Hi,
>
> I am trying to make my client use SOAP 1.2 but it always using the
> SOAP 1.1. Below are more details Can someone please let me know the
> use/intention of Options.setSoapVersionURI().
>
> For the below client code:
>
> public static void main(String[] args) throws MalformedURLException {
>
>                try {
>                        Options options = new Options();
>                        EndpointReference endpointReference = new EndpointReference(
>                                        "http://localhost:8888/axis2/services/TemperatureConverter");
>                        options.setTo(endpointReference);
>                        options.setSoapVersionURI("http://www.w3.org/2003/05/soap");
>                        options.setAction("urn:c2f");
>
>                        ServiceClient client = new ServiceClient();
>                        client.setOptions(options);
>
>                        OMElement request = createRequest();
>                        OMElement response = client.sendReceive(request);
>
>                        System.out.println("Request:  " + request);
>                        System.out.println("Response: " + response);
>
>                } catch (AxisFault e) {
>                        e.printStackTrace();
>                }
>
>        }
>
>
> I get the following SOAP envelope (using tcpmon):
> POST /axis2/services/TemperatureConverter HTTP/1.1
> Content-Type: text/xml; charset=UTF-8
> SOAPAction: "urn:anonOutInOp"
> User-Agent: Axis2
> Host: 127.0.0.1:8888
> Transfer-Encoding: chunked
>
> 102
> <?xml version='1.0' encoding='UTF-8'?>
>   <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
>      <soapenv:Body>
>         <ns1:c2f xmlns:ns1="http://temperature.training.wso2.com">
>            <ns1:cTemp>120.0</ns1:cTemp>
>         </ns1:c2f>
>      </soapenv:Body>
>   </soapenv:Envelope>0
>
> I replaced options.setSoapVersionURI("http://www.w3.org/2003/05/soap") with
> options.setSoapVersionURI("http://schemas.xmlsoap.org/wsdl/soap12/")
> but to no avail.
>
> I am aware that by using ServiceClient client = new
> ServiceClient(context,....) I can get
> a SOAP1.2 envelope. But I am wondering how use SOAP1.2 with
> ServiceClient client = new ServiceClient()
> and more importantly what is the use/intention of Options.setSoapVersionURI().
>
> Thanks,
> Prateek
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-user-help@axis.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-user-help@axis.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org


AW: Usage of Options.setSoapVersionURI() to get SOAP1.2

Posted by Stadelmann Josef <jo...@axa-winterthur.ch>.
Allow me 3 questions:

What if your server supports both SOAP protocols 1.1 and 1.2?

Would then your client need to say which protocol shall be used actually?

What if your server allows to bind only to one SOAP 1.1 protocol?

Josef



-----Ursprüngliche Nachricht-----
Von: Prateek Asthana [mailto:paryanz@gmail.com] 
Gesendet: Montag, 8. November 2010 13:15
An: java-user@axis.apache.org
Betreff: Usage of Options.setSoapVersionURI() to get SOAP1.2

Hi,

I am trying to make my client use SOAP 1.2 but it always using the
SOAP 1.1. Below are more details Can someone please let me know the
use/intention of Options.setSoapVersionURI().

For the below client code:

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

		try {
			Options options = new Options();
			EndpointReference endpointReference = new EndpointReference(
					"http://localhost:8888/axis2/services/TemperatureConverter");
			options.setTo(endpointReference);
			options.setSoapVersionURI("http://www.w3.org/2003/05/soap");
			options.setAction("urn:c2f");

			ServiceClient client = new ServiceClient();
			client.setOptions(options);

			OMElement request = createRequest();
			OMElement response = client.sendReceive(request);
			
			System.out.println("Request:  " + request);
			System.out.println("Response: " + response);

		} catch (AxisFault e) {
			e.printStackTrace();
		}

	}


I get the following SOAP envelope (using tcpmon):
POST /axis2/services/TemperatureConverter HTTP/1.1
Content-Type: text/xml; charset=UTF-8
SOAPAction: "urn:anonOutInOp"
User-Agent: Axis2
Host: 127.0.0.1:8888
Transfer-Encoding: chunked

102
<?xml version='1.0' encoding='UTF-8'?>
   <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
      <soapenv:Body>
         <ns1:c2f xmlns:ns1="http://temperature.training.wso2.com">
            <ns1:cTemp>120.0</ns1:cTemp>
         </ns1:c2f>
      </soapenv:Body>
   </soapenv:Envelope>0

I replaced options.setSoapVersionURI("http://www.w3.org/2003/05/soap") with
options.setSoapVersionURI("http://schemas.xmlsoap.org/wsdl/soap12/")
but to no avail.

I am aware that by using ServiceClient client = new
ServiceClient(context,....) I can get
a SOAP1.2 envelope. But I am wondering how use SOAP1.2 with
ServiceClient client = new ServiceClient()
and more importantly what is the use/intention of Options.setSoapVersionURI().

Thanks,
Prateek

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org