Reputation: 129
Hi I'm working on a simple c# console application to fetch information from a Java JAX-WS Service. I've gotten my app to call the service and get information back but for some reason the response doesn't populate all of the attributes. I've verified that everything I'm expecting is coming back in the response and I don't think I've got a namespace issue like the other questions I've looked over so far.
Here is my actual Soap Response and I'm getting fileDate populated just fine but fileName is always null.
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ns2:getExtractDateResponse xmlns:ns2="http://endpoint.data_extracts_ws.example.com/">
<dataExtractDateModel>
<fileDate>2015-09-17T00:00:00-05:00</fileDate>
<fileName>export_file.zip</fileName>
</dataExtractDateModel>
</ns2:getExtractDateResponse>
</S:Body>
</S:Envelope>
Here is my console app
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DataExtractsServiceClient.DataExtractsService;
namespace DataExtractsServiceClient
{
class Program
{
static void Main(string[] args)
{
DataExtractsEndpointClient extractService = new DataExtractsEndpointClient();
extractService.ClientCredentials.UserName.UserName = "my_username";
extractService.ClientCredentials.UserName.Password = "my_password";
DataExtractDateModel extractDateModel = extractService.getExtractDate("EXTRACT_NAME");
System.Console.WriteLine("File Name Is " + extractDateModel.fileName);
System.Console.WriteLine("File Date Is " + extractDateModel.fileDate);
System.Console.WriteLine("Finished");
System.Console.ReadLine();
}
}
}
And the App.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
<system.serviceModel>
<bindings>
<customBinding>
<binding name="DataExtractsEndpointPortBinding">
<!-- WsdlImporter encountered unrecognized policy assertions in ServiceDescription 'http://endpoint.data_extracts_ws.example.com/': -->
<!-- <wsdl:binding name='DataExtractsEndpointPortBinding'> -->
<!-- <wsoma:OptimizedMimeSerialization xmlns:wsoma="http://schemas.xmlsoap.org/ws/2004/09/policy/optimizedmimeserialization">..</wsoma:OptimizedMimeSerialization> -->
<mtomMessageEncoding messageVersion="Soap11" />
<httpsTransport authenticationScheme="Basic"/>
</binding>
</customBinding>
</bindings>
<client>
<endpoint address="https://example.com/data_extracts_ws/DataExtractsEndpointService"
binding="customBinding" bindingConfiguration="DataExtractsEndpointPortBinding"
contract="DataExtractsService.DataExtractsEndpoint" name="DataExtractsEndpointPort" />
</client>
</system.serviceModel>
</configuration>
Adding the XSD and WSDL
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:tns="http://endpoint.data_extracts_ws.example.com/" targetNamespace="http://endpoint.data_extracts_ws.example.com/" version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="ExtractException" type="tns:ExtractException" />
<xs:element name="ExtractNotFoundException" type="tns:ExtractNotFoundException" />
<xs:element name="getExtract" type="tns:getExtract" />
<xs:element name="getExtractDate" type="tns:getExtractDate" />
<xs:element name="getExtractDateResponse" type="tns:getExtractDateResponse" />
<xs:element name="getExtractResponse" type="tns:getExtractResponse" />
<xs:complexType name="ExtractException">
<xs:sequence>
<xs:element minOccurs="0" name="message" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="ExtractNotFoundException">
<xs:sequence>
<xs:element minOccurs="0" name="message" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="getExtract">
<xs:sequence>
<xs:element name="extractName" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="getExtractResponse">
<xs:sequence>
<xs:element xmlns:ns1="http://www.w3.org/2005/05/xmlmime" minOccurs="0" name="dataExtractModel" type="tns:DataExtractModel" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="DataExtractModel">
<xs:sequence>
<xs:element minOccurs="0" name="fileName" type="xs:string" />
<xs:element minOccurs="0" name="fileData" type="xs:base64Binary" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="getExtractDate">
<xs:sequence>
<xs:element name="extractName" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="getExtractDateResponse">
<xs:sequence>
<xs:element minOccurs="0" name="dataExtractDateModel" type="tns:DataExtractDateModel" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="DataExtractDateModel">
<xs:sequence>
<xs:element minOccurs="0" name="fileName" type="xs:string" />
<xs:element minOccurs="0" name="fileDate" type="xs:dateTime" />
</xs:sequence>
</xs:complexType>
</xs:schema>
<?xml version="1.0" encoding="utf-8"?>
<WL5G3N2:definitions xmlns:WL5G3N3="http://endpoint.data_extracts_ws.example.com/" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:WL5G3N1="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:WL5G3N4="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:WL5G3N0="http://schemas.xmlsoap.org/ws/2004/09/policy" name="DataExtractsEndpointService" targetNamespace="http://endpoint.data_extracts_ws.example.com/" xmlns:WL5G3N2="http://schemas.xmlsoap.org/wsdl/">
<WL5G3N0:Policy WL5G3N1:Id="Mtom.xml">
<wsoma:OptimizedMimeSerialization xmlns:wsoma="http://schemas.xmlsoap.org/ws/2004/09/policy/optimizedmimeserialization" />
</WL5G3N0:Policy>
<wsp:UsingPolicy WL5G3N2:Required="true" />
<wsp:UsingPolicy WL5G3N2:Required="true" />
<WL5G3N2:types>
<xsd:schema xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://endpoint.data_extracts_ws.example.com/" xmlns:wssutil="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:import schemaLocation="https://www.example.com:443/data_extracts_ws/DataExtractsEndpointService?SCHEMA%2FData+Extracts+Service%2Fxsd%2FData+Extracts+Service+XSD" namespace="http://endpoint.data_extracts_ws.example.com/" />
</xsd:schema>
</WL5G3N2:types>
<WL5G3N2:message name="getExtract">
<WL5G3N2:part name="parameters" element="WL5G3N3:getExtract" />
</WL5G3N2:message>
<WL5G3N2:message name="getExtractResponse">
<WL5G3N2:part name="parameters" element="WL5G3N3:getExtractResponse" />
</WL5G3N2:message>
<WL5G3N2:message name="ExtractException">
<WL5G3N2:part name="fault" element="WL5G3N3:ExtractException" />
</WL5G3N2:message>
<WL5G3N2:message name="ExtractNotFoundException">
<WL5G3N2:part name="fault" element="WL5G3N3:ExtractNotFoundException" />
</WL5G3N2:message>
<WL5G3N2:message name="getExtractDate">
<WL5G3N2:part name="parameters" element="WL5G3N3:getExtractDate" />
</WL5G3N2:message>
<WL5G3N2:message name="getExtractDateResponse">
<WL5G3N2:part name="parameters" element="WL5G3N3:getExtractDateResponse" />
</WL5G3N2:message>
<WL5G3N2:portType name="DataExtractsEndpoint">
<WL5G3N2:operation name="getExtract">
<WL5G3N2:input message="WL5G3N3:getExtract" />
<WL5G3N2:output message="WL5G3N3:getExtractResponse" />
<WL5G3N2:fault name="ExtractException" message="WL5G3N3:ExtractException" />
<WL5G3N2:fault name="ExtractNotFoundException" message="WL5G3N3:ExtractNotFoundException" />
</WL5G3N2:operation>
<WL5G3N2:operation name="getExtractDate">
<WL5G3N2:input message="WL5G3N3:getExtractDate" />
<WL5G3N2:output message="WL5G3N3:getExtractDateResponse" />
<WL5G3N2:fault name="ExtractException" message="WL5G3N3:ExtractException" />
<WL5G3N2:fault name="ExtractNotFoundException" message="WL5G3N3:ExtractNotFoundException" />
</WL5G3N2:operation>
</WL5G3N2:portType>
<WL5G3N2:binding name="DataExtractsEndpointPortBinding" type="WL5G3N3:DataExtractsEndpoint">
<wsp:Policy>
<wsp:PolicyReference URI="#Mtom.xml" />
<wsp:PolicyReference URI="#Mtom.xml" />
</wsp:Policy>
<WL5G3N4:binding transport="http://schemas.xmlsoap.org/soap/http" />
<WL5G3N2:operation name="getExtract">
<WL5G3N4:operation soapAction="" />
<WL5G3N2:input>
<WL5G3N4:body use="literal" />
</WL5G3N2:input>
<WL5G3N2:output>
<WL5G3N4:body use="literal" />
</WL5G3N2:output>
<WL5G3N2:fault name="ExtractException">
<WL5G3N4:fault use="literal" name="ExtractException" namespace="" />
</WL5G3N2:fault>
<WL5G3N2:fault name="ExtractNotFoundException">
<WL5G3N4:fault use="literal" name="ExtractNotFoundException" namespace="" />
</WL5G3N2:fault>
</WL5G3N2:operation>
<WL5G3N2:operation name="getExtractDate">
<WL5G3N4:operation soapAction="" />
<WL5G3N2:input>
<WL5G3N4:body use="literal" />
</WL5G3N2:input>
<WL5G3N2:output>
<WL5G3N4:body use="literal" />
</WL5G3N2:output>
<WL5G3N2:fault name="ExtractException">
<WL5G3N4:fault use="literal" name="ExtractException" namespace="" />
</WL5G3N2:fault>
<WL5G3N2:fault name="ExtractNotFoundException">
<WL5G3N4:fault use="literal" name="ExtractNotFoundException" namespace="" />
</WL5G3N2:fault>
</WL5G3N2:operation>
</WL5G3N2:binding>
<WL5G3N2:service name="DataExtractsEndpointService">
<WL5G3N2:port name="DataExtractsEndpointPort" binding="WL5G3N3:DataExtractsEndpointPortBinding">
<WL5G3N4:address location="https://www.example.com:443/data_extracts_ws/DataExtractsEndpointService" />
</WL5G3N2:port>
</WL5G3N2:service>
</WL5G3N2:definitions>
Upvotes: 0
Views: 516
Reputation: 129
Just wanted to come back and answer this in case anyone else has this issue. The problem was the XSD that Weblogic generated had the elements in a different order than the SOAP response. Java didn't seem to have an issue but C# does. In this case the XSD had file name first and file date second for DataExtractDateModel. When i switched the order it went to working.
Upvotes: 2