OSB 12C REST adapter has blank fields

Viewed 6

I am invoking a business service from OSB 12C that accepts POST methods. I added a REST adapter in the business column after making the request and response XSD's. In the pipeline, I use an XQuery file for transformation of the proxy service's request body to the business service's body.

Examining the receiving app as well as the network traffic, I see that the request is being submitted with a Content-Type: application/x-www-form-urlencoded header, but the payload is completely blank.

As a test, I changed the method to GET. This places the form fields within the URL, so the transformation, etc. is correct. It just doesn't work in the POST method. I've been stuck for a week on this.

Here's the XSD for the business request:

<?xml version = '1.0' encoding = 'UTF-8'?>
<xsd:schema 
  xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
  xmlns:nxsd="http://xmlns.oracle.com/pcbpel/nxsd" 
  xmlns:tns="http://TargetNamespace.com/SmartCardBusiness_GetPendingRequests_request" 
  targetNamespace="http://TargetNamespace.com/SmartCardBusiness_GetPendingRequests_request" 
  elementFormDefault="qualified" attributeFormDefault="unqualified" nxsd:encoding="US-ASCII">

  <xsd:element name="GetPendingRequests-BusinessRequest-Root-Element">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="db" type="xsd:string"/>
        <xsd:element name="fromDate" type="xsd:string"/>
        <xsd:element name="max" type="xsd:integer"/>
        <xsd:element name="page" type="xsd:integer"/>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>

<xsd:annotation>
      <xsd:appinfo>NXSDSAMPLE=</xsd:appinfo>
      <xsd:appinfo>USEHEADER=false</xsd:appinfo>
   </xsd:annotation>
</xsd:schema>

And the XQuery file:

xquery version "1.0" encoding "utf-8";

(:: OracleAnnotationVersion "1.0" ::)

declare namespace smar="http://TargetNamespace.com/SmartCardBusiness_GetPendingRequests_request";
(:: import schema at "GetPendingRequestsBusinessRequest.xsd" ::)

declare variable $db as xs:string external;
declare variable $fromDate as xs:string external;
declare variable $max as xs:integer external;
declare variable $page as xs:integer external;

declare function local:func($db as xs:string, $fromDate as xs:string, $max as xs:integer, $page as xs:integer) as element() 
  (:: schema-element(smar:GetPendingRequests-BusinessRequest-Root-Element) ::) {
    <smar:GetPendingRequests-BusinessRequest-Root-Element 
         xmlns:smar="http://TargetNamespace.com/SmartCardBusiness_GetPendingRequests_request">
        <smar:db>{fn:data($db)}</smar:db>
        <smar:fromDate>{fn:data($fromDate)}</smar:fromDate>
        <smar:max>{fn:data($max)}</smar:max>
        <smar:page>{fn:data($page)}</smar:page>
    </smar:GetPendingRequests-BusinessRequest-Root-Element>
};

local:func($db, $fromDate, $max, $page)

The WADL file:

<?xml version = '1.0' encoding = 'UTF-8'?>
<application xmlns:soa="http://www.oracle.com/soa/rest" 
  xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
  xmlns:tns="http://TargetNamespace.com/SmartCardBusiness_GetPendingRequests_request" 
  xmlns="http://wadl.dev.java.net/2009/02">
   <doc title="SmartCardBusinessServices">WADL Reference for REST calls for smart cards</doc>
   <grammars>
      <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
            <xsd:import namespace="http://TargetNamespace.com/SmartCardBusiness_GetPendingRequests_request" 
            schemaLocation="../../GetPendingRequests/Business/GetPendingRequestsBusinessRequest.xsd"/>
        </xsd:schema>
      <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
            <xsd:import namespace="http://TargetNamespace.com/SmartCardBusiness_GetPendingRequests_response" 
            schemaLocation="../../GetPendingRequests/Business/GetPendingRequestsBusinessResponse.xsd"/>
        </xsd:schema>
   </grammars>
   <resources>
      <resource path="/getPendingRequests">
         <method name="POST" soa:wsdlOperation="GetPendingRequests">
            <request>
               <representation mediaType="application/x-www-form-urlencoded" 
               element="cns:GetPendingRequests-BusinessRequest-Root-Element" 
               xmlns:cns="http://TargetNamespace.com/SmartCardBusiness_GetPendingRequests_request"/>
            </request>
            <response status="200">
               <representation mediaType="application/json" 
               element="cns:GetPendingRequests-BusinessResponse-Root-Element" 
               xmlns:cns="http://TargetNamespace.com/SmartCardBusiness_GetPendingRequests_response"/>
            </response>
         </method>
      </resource>
   </resources>
</application>

Lastly, the WSDL:

<?xml version= '1.0' encoding= 'UTF-8' ?>
<wsdl:definitions
     name="SmartCardBusinessServices"
     targetNamespace="http://xmlns.oracle.com/ServiceBusApplication1/MVRServices/SmartCardBusinessServices"
     xmlns:tns="http://xmlns.oracle.com/ServiceBusApplication1/MVRServices/SmartCardBusinessServices"
     xmlns:inp1="http://TargetNamespace.com/SmartCardBusiness_GetPendingRequests_request"
     xmlns:inp2="http://TargetNamespace.com/SmartCardBusiness_GetPendingRequests_response"
     xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype"
     xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
     xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    >
    <plnk:partnerLinkType name="SmartCardBusinessServices">
        <plnk:role name="SmartCardBusinessServicesProvider" portType="tns:SmartCardBusinessServices_ptt"/>
    </plnk:partnerLinkType>
    <wsdl:types>
        <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
            <xsd:import namespace="http://TargetNamespace.com/SmartCardBusiness_GetPendingRequests_request"
                 schemaLocation="../../GetPendingRequests/Business/GetPendingRequestsBusinessRequest.xsd"/>
        </xsd:schema>
        <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
            <xsd:import namespace="http://TargetNamespace.com/SmartCardBusiness_GetPendingRequests_response"
                 schemaLocation="../../GetPendingRequests/Business/GetPendingRequestsBusinessResponse.xsd"/>
        </xsd:schema>
    </wsdl:types>
    <wsdl:message name="GetPendingRequests_inputMessage">
        <wsdl:part name="request" element="inp1:GetPendingRequests-BusinessRequest-Root-Element"/>
    </wsdl:message>
    <wsdl:message name="GetPendingRequests_outputMessage">
        <wsdl:part name="reply" element="inp2:GetPendingRequests-BusinessResponse-Root-Element"/>
    </wsdl:message>
    <wsdl:portType name="SmartCardBusinessServices_ptt">
        <wsdl:operation name="GetPendingRequests">
            <wsdl:input message="tns:GetPendingRequests_inputMessage"/>
            <wsdl:output message="tns:GetPendingRequests_outputMessage"/>
        </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="SmartCardBusinessServices_ptt-binding" type="tns:SmartCardBusinessServices_ptt">
        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="GetPendingRequests">
            <soap:operation soapAction="GetPendingRequests"/>
            <wsdl:input>
                <soap:body use="literal"/>
            </wsdl:input>
            <wsdl:output>
                <soap:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
</wsdl:definitions>
0 Answers
Related