Showing posts with label Composite. Show all posts
Showing posts with label Composite. Show all posts

Tuesday, December 6, 2011

SOAP Version Mismatch Exception in SOA 11g


Recently one of the queries that was posted in the practice forum was regarding the SOAP version mismatch

Issue
----------------------------
Facing the below exception in client environment when an external client is invoking bpel service deployed on SOA Suite 11.1.1.4.

oracle.j2ee.ws.saaj.soap.SOAPVersionMismatchException: Mime Header Content-Type: text/xml requires SOAP envelope namespace: http://schemas.xmlsoap.org/soap/envelope/: Mime Header Content-Type: text/xml requires SOAP envelope namespace: http://schemas.xmlsoap.org/soap/envelope/

They tried the option of generating SOAP1.2 binding in the wsdl (i.e., open the wsdl in design mode and drag the ‘binding’ component on to the centre pallete, and choose the option of SOAP 1.2) and the WSDL file will have the namespace like http://schemas.xmlsoap.org/soap12/ which is still different from the namespace client is sending.


1.    When the SOAP 1.2 generated wsdl is opened in browser, only SOAP 1.1 namespace is visible. Is the SOA suite overriding SOAP 1.2 with 1.1? How do we enforce SOA suite to use SOAP1.2 namespace?

Solution
------------------
 The problem is due to version mismatch Client is expecting a SOAP 1.2 service where as we are exposing a SOAP 1.1 service. By default the Jdev created BPEL service will be using SOAP 1.1 .The way to change it is to mention a soap version as part of the service in composite.xml

In composite.xml, add the soap version for the exposed service and redeploy, it will start using SOAP 1.2 bindings. By default if soap version is not specified it uses soap 1.1.

sample code snippet of Composite,xml
---------------------------------------------------------
<service name="bpeltest1_client_ep" ui:wsdlLocation="BPELTest1.wsdl">
  </service>


Hope this helps in resolving the version mismatch issues accessing SCA composite services.

Wednesday, July 21, 2010

Decomposing Composite.xml –Part1

writera

In one of my previous blog, I had written on the different components that make up a composite (composite.xml). In this blog, I will try to go a layer deeper and disintegrate the composite.xml file to explain the different values that need to go into each attribute of the main element tags. This will be helpful in case you are writing your own composite.xml or trying to migrate from SOA10g versions to 11g. I will be concentrating more on the service and references tags in this write-up.

Service Element

Synchronous Service

First we will see how a synchronous service is represented in a composite.xml.

Sync Service XML Code snippet Template (Composite.xml)

<service name=" Service Name” ui:wsdlLocation=" URL of abstract wsdl " >

<interface.wsdl interface="[Namespace of the Service as defined in the wsdl]#wsdl.interface[Name of the Request PortType as per the WSDL]"

<binding.ws port="[Namespace of the Service as defined in the wsdl]#wsdl.endpoint([Name of the Service as per WSDL]/[ Name of the Service Port as per WSDL])" location="[URL of the concrete WSDL]"/>

<service>

The attributes corresponding to each element is explained below.

1. attribute name in Service element = [ Sync service name]

2. attribute ui:wsdlLocation in Service element = [URL of the abstract WSDL]

3. attribute interface in interface.wsdl =[Namespace of the Service as defined in the wsdl]#wsdl.interface[Name of the Request PortType as given in the WSDL]

4. attribute port in binding.ws element = [Namespace of the Service as defined in the wsdl]#wsdl.endpoint([Name of the Service as given in the WSDL]/[ Name of the Porttype as given in the WSDL]

5. attribute location in binding.ws element = [URL of the concrete WSDL]

For example::

<service name=" SyncEmployeeService " ui:wsdlLocation="oramds:/apps/geo/service/Employee/SyncEmployee.wsdl" >

<interface.wsdl interface="http://xmlns.geo.com/service/Employee#wsdl.interface(EmployeeRequest)"

<binding.ws port="http://xmlns.geo.com/service/Employee#wsdl.endpoint(SyncEmployeeService_ep/ EmployeeService_pt)"/>

<service>

Asynchronous Service

Now we will see how an Asynchronous service is represented in a composite.xml.

Async Service XML Code snippet Template (Composite.xml)

<service name=" Async Service Name” ui:wsdlLocation=" URL of abstract wsdl " >

<interface.wsdl interface="[Namespace of the Service as defined in the wsdl]#wsdl.interface[Name of the Request PortType as per the WSDL]"

callbackInterface="[Namespace of the Service as defined in the wsdl]#wsdl.interface[Name of the Response PortType as per the WSDL]"/>

<binding.ws port="[Namespace of the Service as defined in the wsdl]#wsdl.endpoint([Name of the Service as per WSDL]/[ Name of the Request Service Port as per WSDL])" location="[URL of the concrete WSDL]"/>

<callback>

<binding.ws port ="[Namespace of the Service as defined in the wsdl]#wsdl.endpoint([Name of the Service as per WSDL]/[ Name of the Response Service Port as per WSDL])" />

</callback>

<service>

1. attribute name in service element = [Async service name]

2. attribute ui:wsdlLocation in service element = [URL of the abstract WSDL]

3. attribute interface in interface.wsdl =[Namespace of the Service as defined in the wsdl]#wsdl.interface[Name of the Request PortType as given in the WSDL]

4. attribute callbackInterface in interface.wsdl element =[Namespace of the Service as defined in the wsdl]#wsdl.interface[Name of the Response Port as given in the WSDL]

In case if you are not finding the response port of the service then wsdl.endpoint can be given as [Name of the Porttype element as given in the WSDL]_ep.

5. attribute port in binding.ws element = [Namespace of the Service as defined in the wsdl]#wsdl.endpoint([Name of the Service as given in the WSDL]/[ Name of the Porttype as given in the WSDL]

6. attribute location in binding.ws element = [URL of the concrete WSDL]

For example ::

<service name="AsyncEmployeeService" ui:wsdlLocation="oramds:/apps/geo/service/Employee/AsyncEmployee.wsdl" >

<interface.wsdl interface="http://xmlns.geo.com/service/Employee#wsdl.interface(EmployeeRequest)"

callbackInterface=" http://xmlns.geo.com/service/Employee#wsdl.interface(EmployeeRequestCallback)"/>

<binding.ws port=" http://xmlns.geo.com/service/Employee #wsdl.endpoint(AsyncEmployeeService_ep/AsyncEmployeeService_pt)" location="” />

<callback>

<binding.ws port=" http://xmlns.geo.com/service/Employee#wsdl.endpoint(AsyncEmployeeService_ep/AsyncEmployeeService_pt)"/>

</callback>

<service>

Concrete WSDL URL for services deployed on SOA server

http://{host}:{port}/soa-infra/services/default)/[ Name of the Service as given in the attribute name of the element definition in the WSDL]/[Name of the Porttype element as given in the WSDL]?WSDL

References Element

Synchronous Reference

Now we will see how an Synchronous reference service is represented in a composite.xml.

Sync Reference XML Code snippet Template (Composite.xml)

<reference name="Sync Reference name" ui:wsdlLocation=" URL of Reference abstract wsdl " >

<interface.wsdl xmlns:ns="http://xmlns.oracle.com/sca/1.0"

interface ="[Namespace of the Reference Service as defined in the wsdl]#wsdl.interface[Name of the Request PortType as per the Reference WSDL]”/>

<binding.ws xmlns:ns="http://xmlns.oracle.com/sca/1.0"

port="[Namespace of the Reference Service as defined in the wsdl]#wsdl.endpoint([Name of the Service as per Reference WSDL]/[ Name of the Service Port as per Reference WSDL])" location="[URL of the Reference concrete WSDL]"/>

</reference>

The attributes corresponding to each element is explained below.

1. attribute name in Service element = [ Sync Reference service name]

2. attribute ui:wsdlLocation in Service element = [URL of the Reference abstract WSDL]

3. attribute interface in interface.wsdl =[Namespace of the Reference Service as defined in the wsdl]#wsdl.interface[Name of the Request PortType as given in the Reference WSDL]

4. attribute port in binding.ws element = [Namespace of the Reference Service as defined in the wsdl]#wsdl.endpoint([Name of the Service as given in the WSDL]/[ Name of the Porttype as given in the Reference WSDL]

5. attribute location in binding.ws element = [URL of the Reference concrete WSDL]

For Example ::

Here the composite snippet which has an external reference to a Sync Person Service

<reference name="SyncReference" ui:wsdlLocation="oramds:/app/geo/references/SyncPerson.wsdl" >

<interface.wsdl xmlns:ns="http://xmlns.oracle.com/sca/1.0"

interface="http://xmlns.geo.com/PersonService#wsdl.interface(PersonService)"/>

<binding.ws xmlns:ns="http://xmlns.oracle.com/sca/1.0"

port="http://xmlns.geo.com/PersonService#wsdl.endpoint(PersonService/PersonService)"

location="http://host:port/soa-infra/services/default/PersonService/client?WSDL"/>

</reference>

Asynchronous Reference

Now we will see how an Asynchronous reference service is represented in a composite.xml.

Async Reference Service XML Code snippet Template (Composite.xml)

<reference name=" Async Reference Service Name” ui:wsdlLocation=" URL of Reference abstract wsdl " >

<interface.wsdl xmlns:ns=http://xmlns.oracle.com/sca/1.0

interface="[Namespace of the Reference Service as defined in the wsdl]#wsdl.interface[Name of the Request PortType as per the Reference WSDL]"

callbackInterface="[Namespace of the Service as defined in the Reference wsdl]#wsdl.interface[Name of the Response PortType as per the Reference WSDL]"/>

<binding.ws xmlns:ns="http://xmlns.oracle.com/sca/1.0"

port="[Namespace of the Service as defined in the Reference wsdl]#wsdl.endpoint([Name of the Service as per Reference WSDL]/[ Name of the Request Service Port as per Reference WSDL])" location="[URL of the Reference concrete WSDL]"/>

<callback>

<binding.ws xmlns:ns="http://xmlns.oracle.com/sca/1.0"

port ="[Namespace of the Service as defined in the Reference wsdl]#wsdl.endpoint([Name of the Service as per Reference WSDL]/[ Name of the Response Service Port as per Reference WSDL])"/>

</callback>

<reference>

1. attribute name in service element = [Asynchronous Reference service name]

2. attribute ui:wsdlLocation in service element = [URL of the Reference abstract WSDL]

3. attribute interface in interface.wsdl =[Namespace of the Service as defined in the Reference wsdl]#wsdl.interface[Name of the Request PortType as given in the Reference WSDL]

4. attribute callbackInterface in interface.wsdl element =[Namespace of the Service as defined in the Reference wsdl]#wsdl.interface[Name of the Response Port as given in the Reference WSDL]

In case if you are not finding the response port of the service then wsdl.endpoint can be given as [Name of the Porttype element as given in the Reference WSDL]_ep.

5. attribute port in binding.ws element = [Namespace of the Service as defined in the Reference wsdl]#wsdl.endpoint([Name of the Service as given in the Reference WSDL]/[ Name of the Porttype as given in the Reference WSDL]

6. attribute location in binding.ws element = [URL of the Reference concrete WSDL]

For Example ::

Here the composite has a external reference to a ASync Person Service

<reference name="AsyncReference” ui:wsdlLocation="oramds:/app/geo/references/AsyncPerson.wsdl">

<interface.wsdl xmlns:ns="http://xmlns.oracle.com/sca/1.0"

interface="http://xmlns.geo.com/AsyncPersonService#wsdl.interface(AsyncPersonService)"

callbackInterface="http://xmlns.geo.com/AsyncPersonService #wsdl.interface(AsyncPersonServiceCallback)"/>

<binding.ws xmlns:ns="http://xmlns.oracle.com/sca/1.0"

port="http://xmlns.geo.com/AsyncPersonService#wsdl.endpoint(AsyncPersonService/AsyncPersonService)"

location="http://host:port/soa-infra/services/default/AsyncPersonService/client?WSDL"/>

<callback>

<binding.ws port="http://xmlns.geo.com/AsyncPersonService#wsdl.endpoint(AsyncPersonService/AsyncPersonService)"/>

</callback>

</reference>

All the attribute values for services and references are similar, only the components as part of a service or reference vary from Synchronous service to asynchronous service to accommodate the callback mechanism. That’s pretty much for the day and month as I am going on vacation. NjoyJ