Reputation: 686
I am using Oracle Service Bus 12C to translate REST calls between my and third-party servers.
I set the REST component on the proxy as well as the business side to use WSDL. I create 4 XSD's (for the proxy request, proxy response, business request and business response). In the pipeline, I use an XQuery transformation file to convert outgoing requests and incoming responses.
A typical transformation would be:
xquery version "1.0" encoding "utf-8";
(:: OracleAnnotationVersion "1.0" ::)
declare namespace ns1="http://TargetNamespace.com/NumberplateProxy_GetPendingRequests_response";
(:: import schema at "GetPendingRequestsProxyResponse.xsd" ::)
declare namespace inp1="http://TargetNamespace.com/NumberplateBusiness_GetPendingRequests_response";
(:: import schema at "../Business/GetPendingRequestsBusinessResponse.xsd" ::)
declare variable $statusCode as xs:string external;
declare variable $statusDescription as xs:string external;
declare variable $data external;
declare function local:func($statusCode as xs:string, $statusDescription as xs:string, $data) as element()
(:: schema-element(ns1:GetPendingRequests-ProxyResponse-Root-Element) ::)
(:: schema-element(inp1:GetPendingRequests-BusinessResponse-Root-Element) ::){
<ns1:GetPendingRequests-ProxyResponse-Root-Element
xmlns:ns1="http://TargetNamespace.com/NumberplateProxy_GetPendingRequests_response">
<ns1:statusCode>{fn:data($statusCode)}</ns1:statusCode>
<ns1:statusDescription>{fn:data($statusDescription)}</ns1:statusDescription>
{
if( $data eq "" ) then (
<ns1:data/>
) else (
for $x in $data/inp1:data
return <ns1:data>
<ns1:REQUESTID>{fn:data($x/inp1:REQUESTID)}</ns1:REQUESTID>
<ns1:REGISTRATIONNUMBER>{fn:data($x/inp1:REGISTRATIONNUMBER)}</ns1:REGISTRATIONNUMBER>
<ns1:CATEGORY>{fn:data($x/inp1:CATEGORY)}</ns1:CATEGORY>
</ns1:data>
)
}
</ns1:GetPendingRequests-ProxyResponse-Root-Element>
};
local:func($statusCode, $statusDescription, $data)
The pipeline debugger is used to view the workflow and the data. This works well except for when it comes to debugging what happens inside the XQuery. Is there any way to debug that?
Upvotes: 1
Views: 264
Reputation: 1
XQuery transformations in OSB cannot be debugged. The best way of "debugging" I've found if the transformation fails in the pipeline is to remove parts of the XQuery function that is being executed until I find which statement is failing.
Upvotes: 0