+ Start a Discussion
Vandana Rattan 4Vandana Rattan 4 

Issue while invoking web service

Hi All,

I have created a SOA DB Adapter webservice to update database. I am able to successfully test the service from Em console and using SOAPUI. I now want to call this service from Salesforce. I have:

1. Generated Stub classes using the WSDL 
2. Write a class to call web service
3. Invoke the class from trigger

I am getting following error:

16:07:42:030 EXCEPTION_THROWN [37]|System.CalloutException: Web service callout failed: Unexpected element. Parser was expecting element 'http://schemas.xmlsoap.org/soap/envelope/:Envelope' but found ':html'

I cannot see any instances getting generated on EM console so perhaps it isn't hitting the service at all. 

Also my webservice end point looks like:

http://192.168.24.7:8001/soa-infra/services/default/TestDBAdapter/bpelprocess1_client_ep

So what should I put in Remote Sites Settings? Currently I have following http://192.168.24.7:8001

TIA



 
Harish M 8Harish M 8
it means you are getting HTML response rather than XML response....if ur request is correct and all is good from other end also...

this type of errors will come some times...try to hit that from otherend like postman and see ... if it is working fine
then just paste your code here
 
Vandana Rattan 4Vandana Rattan 4
Hi Harish,

Thank you for your reply. I could run it fine using Postman. My req and resp are:

Req:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
        <soap:Body>
                <ns1:process xmlns:ns1="http://xmlns.oracle.com/SampleAdap/TestDBAdapter/BPELProcess1">
                        <ns1:personid>2713020</ns1:personid>
                        <ns1:personnameid>380</ns1:personnameid>
                        <ns1:firstname>Vani</ns1:firstname>
        </ns1:process>
    </soap:Body>
</soap:Envelope>

Resp:
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://www.w3.org/2005/08/addressing">
    <env:Header>
        <wsa:MessageID>urn:888E04A0F24611E68F6F61967CABB3D8</wsa:MessageID>
        <wsa:ReplyTo>
            <wsa:Address>http://www.w3.org/2005/08/addressing/anonymous</wsa:Address>
        </wsa:ReplyTo>
        <wsa:FaultTo>
            <wsa:Address>http://www.w3.org/2005/08/addressing/anonymous</wsa:Address>
        </wsa:FaultTo>
    </env:Header>
    <env:Body>
        <processResponse xmlns="http://xmlns.oracle.com/SampleAdap/TestDBAdapter/BPELProcess1">
            <result/>
        </processResponse>
    </env:Body>
</env:Envelope>

My composite XML is:

<?xml version="1.0" encoding="UTF-8" ?>
<!-- Generated by Oracle SOA Modeler version 11.1.1.7.0 at [10/02/17 11:24 AM]. -->
<composite name="TestDBAdapter"
           revision="1.0"
           label="2017-02-10_11-24-05_578"
           mode="active"
           state="on"
           xmlns="http://xmlns.oracle.com/sca/1.0"
           xmlns:xs="http://www.w3.org/2001/XMLSchema"
           xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
           xmlns:orawsp="http://schemas.oracle.com/ws/2006/01/policy"
           xmlns:ui="http://xmlns.oracle.com/soa/designer/">
  <import namespace="http://xmlns.oracle.com/pcbpel/adapter/db/SampleAdap/TestDBAdapter/WritePersonName"
          location="WritePersonName.wsdl" importType="wsdl"/>
  <import namespace="http://xmlns.oracle.com/SampleAdap/TestDBAdapter/BPELProcess1"
          location="BPELProcess1.wsdl" importType="wsdl"/>
  <service name="bpelprocess1_client_ep" ui:wsdlLocation="BPELProcess1.wsdl">
    <interface.wsdl interface="http://xmlns.oracle.com/SampleAdap/TestDBAdapter/BPELProcess1#wsdl.interface(BPELProcess1)"/>
    <binding.ws port="http://xmlns.oracle.com/SampleAdap/TestDBAdapter/BPELProcess1#wsdl.endpoint(bpelprocess1_client_ep/BPELProcess1_pt)"/>
  </service>
  <property name="productVersion" type="xs:string" many="false">11.1.1.7.0</property>
  <component name="BPELProcess1" version="2.0">
    <implementation.bpel src="BPELProcess1.bpel"/>
    <property name="bpel.config.transaction" type="xs:string" many="false">required</property>
    <property name="bpel.config.oneWayDeliveryPolicy" type="xs:string"
              many="false">async.persist</property>
  </component>
  <reference name="WritePersonName" ui:wsdlLocation="WritePersonName.wsdl">
    <interface.wsdl interface="http://xmlns.oracle.com/pcbpel/adapter/db/SampleAdap/TestDBAdapter/WritePersonName#wsdl.interface(WritePersonName_ptt)"/>
    <binding.jca config="WritePersonName_db.jca"/>
    <property name="jca.retry.count" type="xs:int" many="false" override="may">4</property>
    <property name="jca.retry.interval" type="xs:int" many="false"
              override="may">1</property>
    <property name="jca.retry.backoff" type="xs:int" many="false"
              override="may">2</property>
    <property name="jca.retry.maxInterval" type="xs:string" many="false"
              override="may">120</property>
  </reference>
  <wire>
    <source.uri>bpelprocess1_client_ep</source.uri>
    <target.uri>BPELProcess1/bpelprocess1_client</target.uri>
  </wire>
  <wire>
    <source.uri>BPELProcess1/WritePersonName</source.uri>
    <target.uri>WritePersonName</target.uri>
  </wire>
</composite>

The BPEL code is:

<?xml version = "1.0" encoding = "UTF-8" ?>
<!--
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  Oracle JDeveloper BPEL Designer 
  
  Created: Fri Feb 10 11:26:25 EST 2017
  Author:  VRattan
  Type: BPEL 2.0 Process
  Purpose: Synchronous BPEL Process
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-->
<process name="BPELProcess1"
         targetNamespace="http://xmlns.oracle.com/SampleAdap/TestDBAdapter/BPELProcess1"
         xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
         xmlns:client="http://xmlns.oracle.com/SampleAdap/TestDBAdapter/BPELProcess1"
         xmlns:ora="http://schemas.oracle.com/xpath/extension"
         xmlns:bpelx="http://schemas.oracle.com/bpel/extension"
         xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
         xmlns:ns1="http://xmlns.oracle.com/pcbpel/adapter/db/SampleAdap/TestDBAdapter/WritePersonName"
         xmlns:ns2="http://xmlns.oracle.com/pcbpel/adapter/db/top/WritePersonName"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <import namespace="http://xmlns.oracle.com/SampleAdap/TestDBAdapter/BPELProcess1"
          location="BPELProcess1.wsdl"
          importType="http://schemas.xmlsoap.org/wsdl/"/>
  <!-- 
      ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        PARTNERLINKS                                                      
        List of services participating in this BPEL process               
      ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    -->
  <partnerLinks>
    <!-- 
      The 'client' role represents the requester of this service. It is 
      used for callback. The location and correlation information associated
      with the client role are automatically set using WS-Addressing.
    -->
    <partnerLink name="bpelprocess1_client"
                 partnerLinkType="client:BPELProcess1"
                 myRole="BPELProcess1Provider"/>
    <partnerLink name="WritePersonName"
                 partnerLinkType="ns1:WritePersonName_plt"
                 partnerRole="WritePersonName_role"/>
  </partnerLinks>
  <!-- 
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
      VARIABLES                                                        
      List of messages and XML documents used within this BPEL process 
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  -->
  <variables>
    <!-- Reference to the message passed as input during initiation -->
    <variable name="inputVariable"
              messageType="client:BPELProcess1RequestMessage"/>
    <!-- Reference to the message that will be returned to the requester-->
    <variable name="outputVariable"
              messageType="client:BPELProcess1ResponseMessage"/>
    <variable name="Invoke1_update_InputVariable"
              messageType="ns1:PersonNameCollection_msg"/>
  </variables>
  <!-- 
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     ORCHESTRATION LOGIC                                               
     Set of activities coordinating the flow of messages across the    
     services integrated within this business process                  
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  -->
  <sequence name="main">
    <!-- Receive input from requestor. (Note: This maps to operation defined in BPELProcess1.wsdl) -->
    <receive name="receiveInput" partnerLink="bpelprocess1_client"
             portType="client:BPELProcess1" operation="process"
             variable="inputVariable" createInstance="yes"/>
    <assign name="Assign1">
      <copy>
        <from>$inputVariable.payload/client:personid</from>
        <to>$Invoke1_update_InputVariable.PersonNameCollection/ns2:PersonName/ns2:personId</to>
      </copy>
      <copy>
        <from>$outputVariable.payload/client:result</from>
        <to>$outputVariable.payload/client:result</to>
      </copy>
      <copy>
        <from>$inputVariable.payload/client:firstname</from>
        <to>$Invoke1_update_InputVariable.PersonNameCollection/ns2:PersonName/ns2:givenName</to>
      </copy>
      <copy>
        <from>$inputVariable.payload/client:personnameid</from>
        <to>$Invoke1_update_InputVariable.PersonNameCollection/ns2:PersonName/ns2:personNameId</to>
      </copy>
    </assign>
    <invoke name="Invoke1" partnerLink="WritePersonName"
            portType="ns1:WritePersonName_ptt" operation="update"
            inputVariable="Invoke1_update_InputVariable"
            bpelx:invokeAsDetail="no"/>
    <!-- Generate reply to synchronous request -->
    <reply name="replyOutput" partnerLink="bpelprocess1_client"
           portType="client:BPELProcess1" operation="process"
           variable="outputVariable"/>
  </sequence>
</process>

Please let me know if you need any further details.

Thanks,
Vandana