My C# app won't give me anything but null results from SOAP calls.
We have exposed some PeopleSoft ERP data with a SOAP web service.
I am accessing this SOAP service from a Visual Studio 2012 ASP.NET C# app. I have a Service Reference named CampusDirectoryService built using the WSDL generated by the ERP.
Here's the C# code:
var service = new CampusDirectoryService.TEST_PortTypeClient();
var input = new CampusDirectoryService.InputParameters();
input.First_Name = FirstNameBox.Text;
input.Last_Name = LastNameBox.Text;
var returnData = service.TEST_OP(input);
The problem is returnData
is always null. Through Wireshark, I confirmed that I am in fact getting a valid SOAP response with data. returnData
should not be null.
I have confirmed correct valid results from the SOAP service through soapUI, too. Submitting the exact same SOAP request that .NET sends (I copied it out of Wireshark), I get expected results.
Here's the SOAP request:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<InputParameters xmlns="http://xmlns.oracle.com/Enterprise/Tools/schemas">
<Last_Name xmlns="">cambre</Last_Name>
<First_Name xmlns="">aren</First_Name>
</InputParameters>
</s:Body>
</s:Envelope>
Here's the SOAP response, with some internal data inside the ReturnID
element obfuscated or removed:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<root xmlns="http://peoplesoft.com/rootResponse">
<ReturnID>
<PRF_Name>Cambre,Aren</PRF_Name>
<Camp_Email>[email protected]</Camp_Email>
</ReturnID>
</root>
</soapenv:Body>
</soapenv:Envelope>
The return type of the TEST_OP
method is CampusDirectoryService.rootReturnID[]
.
Why is returnData
always null?
UPDATE Per a comment, I validated the messages with soapUI. It's squawking on the response with this message:
line -1: Missing message part with name [{http://xmlns.oracle.com/Enterprise/Tools/schemas}root]
Here's the XSD for the response:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema targetNamespace="http://xmlns.oracle.com/Enterprise/Tools/schemas" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="root">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="ReturnID">
<xs:complexType>
<xs:sequence>
<xs:element name="PRF_Name" type="xs:string" />
<xs:element name="Camp_Email" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Is the XSD supposed to validate what's inside soapenv:Body
, or is it supposed to validate the entire response, including the soapenv:Envelope
and soapenv:Body
elements? Looks like soapUI expects the XSD to validate the entire response, not just what's inside soapenv:Body
.
Here's the WSDL:
<wsdl:definitions name="TEST.1" targetNamespace="http://xmlns.oracle.com/Enterprise/HCM/schemas/TEST.1" xmlns:U_IT_CAMDIR_REQUEST_MSG.VERSION_1="http://xmlns.oracle.com/Enterprise/Tools/schemas" xmlns:U_IT_CAMDIR_RESPONSE_MSG.VERSION_1="http://xmlns.oracle.com/Enterprise/Tools/schemas" xmlns:plnk="http://schemas.xmlsoap.org/ws/2003/05/partner-link/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://xmlns.oracle.com/Enterprise/HCM/schemas/TEST.1" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsp="http://schemas.xmlsoap.org/ws/2002/12/policy">
<wsp:UsagePolicy wsdl:Required="true"/>
<plnk:partnerLinkType name="TEST_PartnerLinkType">
<plnk:role name="TEST_Provider">
<plnk:portType name="tns:TEST_PortType"/>
</plnk:role>
</plnk:partnerLinkType>
<wsdl:types>
<xsd:schema elementFormDefault="qualified" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:import namespace="http://xmlns.oracle.com/Enterprise/Tools/schemas" schemaLocation="U_IT_CAMDIR_REQUEST_MSG.VERSION_1.xsd"/>
<xsd:import namespace="http://xmlns.oracle.com/Enterprise/Tools/schemas" schemaLocation="U_IT_CAMDIR_RESPONSE_MSG.VERSION_1.xsd"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="U_IT_CAMDIR_REQUEST_MSG.VERSION_1">
<wsdl:documentation>People Directory</wsdl:documentation>
<wsdl:part element="U_IT_CAMDIR_REQUEST_MSG.VERSION_1:InputParameters" name="parameter"/>
</wsdl:message>
<wsdl:message name="U_IT_CAMDIR_RESPONSE_MSG.VERSION_1">
<wsdl:documentation>People Directory</wsdl:documentation>
<wsdl:part element="U_IT_CAMDIR_RESPONSE_MSG.VERSION_1:root" name="parameter"/>
</wsdl:message>
<wsdl:portType name="TEST_PortType">
<wsdl:operation name="TEST_OP">
<wsdl:documentation>TEST</wsdl:documentation>
<wsdl:input message="tns:U_IT_CAMDIR_REQUEST_MSG.VERSION_1" name="U_IT_CAMDIR_REQUEST_MSG.VERSION_1"/>
<wsdl:output message="tns:U_IT_CAMDIR_RESPONSE_MSG.VERSION_1" name="U_IT_CAMDIR_RESPONSE_MSG.VERSION_1"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="TEST_Binding" type="tns:TEST_PortType">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="TEST_OP">
<soap:operation soapAction="TEST_OP.v1" style="document"/>
<wsp:Policy wsu:Id="UsernameTokenSecurityPolicyPasswordOptional" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsp:ExactlyOne>
<wsp:All>
<wsse:SecurityToken wsp:Usage="wsp:Required" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:TokenType>wsse:UserNameToken</wsse:TokenType>
<Claims>
<SubjectName MatchType="wsse:Exact"/>
<UsePassword wsp:Usage="wsp:Optional"/>
</Claims>
</wsse:SecurityToken>
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
<wsdl:input name="U_IT_CAMDIR_REQUEST_MSG.VERSION_1">
<soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" use="literal"/>
</wsdl:input>
<wsdl:output name="U_IT_CAMDIR_RESPONSE_MSG.VERSION_1">
<soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="TEST">
<wsdl:documentation>TEST</wsdl:documentation>
<wsdl:port binding="tns:TEST_Binding" name="TEST_Port">
<soap:address location="http://domainname.com/longurltoSOAPservicehere"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
HTTP ResponseClick the 'RAW' Tab in SOAP-UI Response Window to understand how the response is sent via HTTP. After processing the request, the http response code (200) is shown which means it is a success. The web-server has processed it successfully.
A SOAP message is an ordinary XML document containing the following elements: An Envelope element that identifies the XML document as a SOAP message. A Header element that contains header information. A Body element that contains call and response information.
C# SOAP is independent of platform and operating system on which it is working which makes it easier for it to exchange data between different applications working on different platforms. It is a loosely coupled protocol because it doesn't require communicating applications to be in the same language.
From Oracle The issue is resolved by Bug ID 11560861 in PT8.50.00
In PT 8.50 Steps: A. Recreate the schema for the reply message: 1. Peopletools>Integration Broker>Integration Setup>Messages. 2. Choose the COMBO_CF_EDIT_REPLY message. 3. Select the check box "Include Namesapce". 4. Save.
B. Regenerate the WSDL: 1. Peopletools>Integration Broker>Web Services. 2. Choose the COMBO_CF_EDIT_REQUEST service operation. 3. Continue with the Provide Web Services wizard to generate the WSDL.
Prior to upgrading to 8.50 there are three workaround options:
A. Modify the WSDL:
1. Generate the WSDL from PeopleTools and then save to file.
2. Update the WSDL file by modifying the reply to have the entry
to replace the generated: xmlns="http://xmlns.oracle.com/Enterprise/FSCM/schema/COMBO_CF_EDIT_REPLYResponse">"
Then read the WSDL file back into the repository. Peopletools>Integration Broker>Web Services>Consume Web Services.
OR B. Convert the rowset based messages to container/ part rowset messages.
To create container/row set parts messages see: PeopleBook: PeopleSoft Integration Broker > Managing Messages>Managing Message Parts PeopleBook: PeopleSoft Integration Broker > Managing Messages>Managing Container Messages
Modify the Service Operation to reference the Container Messasge.
OR C. Transform the outbound response messages via XSLT or PeopleCode to match the WSDL is another way to adjust the actual response xmlns to the expected value.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With