Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

WCF app calling Java web service only serializes string members

Posted on 2008-10-15
1
Medium Priority
?
1,612 Views
Last Modified: 2013-11-19
I have a C# WCF service that is currently hosted in a Windows Forms application.  It communicates with two applications.  One application is an in-house managed C++ application that is fully WCF compatible and implements a callback interface for bidirectional communication.  That interface is working correctly.

The other application is a 3rd-party client's application written in Java.  It does not understand WCF, so I implemented a custom binding that uses Soap 1.2 to facilitate communicate from the Java app to my service.  That communication is working correctly.  Since a callback interface can't be supported, the 3rd-party client implemented a web service in Java to allow my service to 'call back' to his application.  This is where I'm having the problems.

The problem is that the body of the soap messages sent from my WCF service to the Java web service contain only string members of my types.  All 'int' and 'bool' members are missing.  This is not a WSDL issue - they are present in the WSDL and the auto-generated code created when the service reference is created contains all members - strings, ints and bools.

I've tried using both a web reference to access the Java web service and a service reference to reference the Java web service - I see the exact same result either way.

I did some googling and I know that I can switch from the DataContractSerializer to the XmlSerializer, but I really don't want to do that - my interface is large & there are a LOT of data contract items that would have to be reworked to use the XmlSerializer.

HELP!!!!  I have a real time-crunch to get this project completed and have run out of ideas.

I'm attaching a code snippet that contains the WSDL obtained from the Java web service & the SOAP that is generated (captured via tcptrace utility).  Note that I'm calling the method phoneNumbersRequest which takes a parameter of type OCPhoneNumbersRequest.
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ns="http://service.dialer.css.com" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:ax21="http://data.dialer.css.com/xsd" xmlns:ns1="http://org.apache.axis2/xsd" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://service.dialer.css.com" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
  <wsdl:documentation />
  <wsdl:types>
    <xs:schema xmlns:ax22="http://data.dialer.css.com/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://service.dialer.css.com">
      <xs:import namespace="http://data.dialer.css.com/xsd" />
      <xs:element name="agentStatus">
        <xs:complexType>
          <xs:sequence>
            <xs:element minOccurs="0" name="input" nillable="true" type="ax22:OCAgentStatus" />
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="dialedNumber">
        <xs:complexType>
          <xs:sequence>
            <xs:element minOccurs="0" name="input" nillable="true" type="ax22:OCDialedNumber" />
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="errorNotification">
        <xs:complexType>
          <xs:sequence>
            <xs:element minOccurs="0" name="input" nillable="true" type="ax22:OCErrorNotification" />
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="outboundCallConnection">
        <xs:complexType>
          <xs:sequence>
            <xs:element minOccurs="0" name="input" nillable="true" type="ax22:OCOutboundCallConnection" />
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="phoneNumbersRequest">
        <xs:complexType>
          <xs:sequence>
            <xs:element minOccurs="0" name="inputRequest" nillable="true" type="ax22:OCPhoneNumbersRequest" />
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:schema>
    <xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://data.dialer.css.com/xsd">
      <xs:complexType name="OCMessageBase">
        <xs:sequence>
          <xs:element minOccurs="0" name="destinationSystemId" nillable="true" type="xs:string" />
          <xs:element minOccurs="0" name="internalMessageId" nillable="true" type="xs:string" />
          <xs:element minOccurs="0" name="operationType" nillable="true" type="xs:string" />
          <xs:element minOccurs="0" name="sourceSystemId" nillable="true" type="xs:string" />
        </xs:sequence>
      </xs:complexType>
      <xs:complexType name="OCAgentStatus">
        <xs:complexContent mixed="false">
          <xs:extension base="ax21:OCMessageBase">
            <xs:sequence>
              <xs:element minOccurs="0" name="agentId" nillable="true" type="xs:string" />
              <xs:element minOccurs="0" name="agentState" nillable="true" type="xs:string" />
              <xs:element minOccurs="0" name="audioLineState" nillable="true" type="xs:string" />
              <xs:element minOccurs="0" name="audioPort" type="xs:int" />
              <xs:element minOccurs="0" name="callsTaken" type="xs:int" />
              <xs:element minOccurs="0" name="callsTakenThisHour" type="xs:int" />
              <xs:element minOccurs="0" name="campaignId" nillable="true" type="xs:string" />
              <xs:element minOccurs="0" name="originatingHostId" nillable="true" type="xs:string" />
              <xs:element minOccurs="0" name="secondsInCurrentState" type="xs:int" />
              <xs:element minOccurs="0" name="successes" type="xs:int" />
              <xs:element minOccurs="0" name="successesThisHour" type="xs:int" />
              <xs:element minOccurs="0" name="talkTime" type="xs:int" />
              <xs:element minOccurs="0" name="teamName" nillable="true" type="xs:string" />
              <xs:element minOccurs="0" name="telephoneLine" type="xs:int" />
              <xs:element minOccurs="0" name="workstationId" nillable="true" type="xs:string" />
            </xs:sequence>
          </xs:extension>
        </xs:complexContent>
      </xs:complexType>
      <xs:complexType name="OCDialedNumber">
        <xs:complexContent mixed="false">
          <xs:extension base="ax21:OCMessageBase">
            <xs:sequence>
              <xs:element minOccurs="0" name="accountId" nillable="true" type="xs:string" />
              <xs:element minOccurs="0" name="callAttempts" type="xs:int" />
              <xs:element minOccurs="0" name="campaignId" nillable="true" type="xs:string" />
              <xs:element minOccurs="0" name="desk" nillable="true" type="xs:string" />
              <xs:element minOccurs="0" name="mQID" nillable="true" type="xs:string" />
              <xs:element minOccurs="0" name="phoneNumber" nillable="true" type="xs:string" />
              <xs:element minOccurs="0" name="phoneNumberType" nillable="true" type="xs:string" />
              <xs:element minOccurs="0" name="resultCode" nillable="true" type="xs:string" />
              <xs:element minOccurs="0" name="timeDialed" nillable="true" type="xs:dateTime" />
            </xs:sequence>
          </xs:extension>
        </xs:complexContent>
      </xs:complexType>
      <xs:complexType name="OCErrorNotification">
        <xs:complexContent mixed="false">
          <xs:extension base="ax21:OCMessageBase">
            <xs:sequence>
              <xs:element minOccurs="0" name="agentId" nillable="true" type="xs:string" />
              <xs:element minOccurs="0" name="campaignId" nillable="true" type="xs:string" />
              <xs:element minOccurs="0" name="errorMessage" nillable="true" type="xs:string" />
              <xs:element minOccurs="0" name="errorSourceMessage" nillable="true" type="xs:string" />
              <xs:element minOccurs="0" name="errorSourceMessageCode" type="xs:int" />
              <xs:element minOccurs="0" name="errorTime" nillable="true" type="xs:dateTime" />
            </xs:sequence>
          </xs:extension>
        </xs:complexContent>
      </xs:complexType>
      <xs:complexType name="OCOutboundCallConnection">
        <xs:complexContent mixed="false">
          <xs:extension base="ax21:OCMessageBase">
            <xs:sequence>
              <xs:element minOccurs="0" name="accountId" nillable="true" type="xs:string" />
              <xs:element minOccurs="0" name="agentExtension" nillable="true" type="xs:string" />
              <xs:element minOccurs="0" name="agentId" nillable="true" type="xs:string" />
              <xs:element minOccurs="0" name="callType" nillable="true" type="xs:string" />
              <xs:element minOccurs="0" name="campaignId" nillable="true" type="xs:string" />
              <xs:element minOccurs="0" name="connectionReason" nillable="true" type="xs:string" />
              <xs:element minOccurs="0" name="inboundQueueCount" type="xs:int" />
              <xs:element minOccurs="0" name="outboundHoldingCount" type="xs:int" />
              <xs:element minOccurs="0" name="phoneNumberDialed" nillable="true" type="xs:string" />
              <xs:element minOccurs="0" name="phoneType" nillable="true" type="xs:string" />
              <xs:element minOccurs="0" name="recordingType" nillable="true" type="xs:string" />
              <xs:element minOccurs="0" name="secondsSinceConnected" type="xs:int" />
              <xs:element minOccurs="0" name="telcoLineNumber" type="xs:int" />
              <xs:element minOccurs="0" name="transferResultCode" nillable="true" type="xs:string" />
              <xs:element minOccurs="0" name="transferredFromCampaignId" nillable="true" type="xs:string" />
              <xs:element minOccurs="0" name="transmissionAttempts" type="xs:int" />
            </xs:sequence>
          </xs:extension>
        </xs:complexContent>
      </xs:complexType>
      <xs:complexType name="OCPhoneNumbersRequest">
        <xs:complexContent mixed="false">
          <xs:extension base="ax21:OCMessageBase">
            <xs:sequence>
              <xs:element minOccurs="0" name="agentsLoggedOn" type="xs:int" />
              <xs:element minOccurs="0" name="campaignId" nillable="true" type="xs:string" />
              <xs:element minOccurs="0" name="maxNumbersToRetrieve" type="xs:int" />
              <xs:element minOccurs="0" name="maxRequestAttempts" type="xs:int" />
              <xs:element minOccurs="0" name="numberOfRequestsWithoutResponse" type="xs:int" />
              <xs:element minOccurs="0" name="numbersInNewNumberQueue" type="xs:int" />
              <xs:element minOccurs="0" name="requestStringerval" type="xs:int" />
              <xs:element minOccurs="0" name="solicitedNumbers" type="xs:boolean" />
              <xs:element minOccurs="0" name="stringernalReasonId" nillable="true" type="xs:string" />
              <xs:element minOccurs="0" name="testNumber" nillable="true" type="xs:string" />
            </xs:sequence>
          </xs:extension>
        </xs:complexContent>
      </xs:complexType>
    </xs:schema>
  </wsdl:types>
  <wsdl:message name="errorNotificationRequest">
    <wsdl:part name="parameters" element="ns:errorNotification" />
  </wsdl:message>
  <wsdl:message name="runHostStartRequestRequest" />
  <wsdl:message name="agentStatusRequest">
    <wsdl:part name="parameters" element="ns:agentStatus" />
  </wsdl:message>
  <wsdl:message name="dialedNumberRequest">
    <wsdl:part name="parameters" element="ns:dialedNumber" />
  </wsdl:message>
  <wsdl:message name="outboundCallConnectionRequest">
    <wsdl:part name="parameters" element="ns:outboundCallConnection" />
  </wsdl:message>
  <wsdl:message name="phoneNumbersRequestRequest">
    <wsdl:part name="parameters" element="ns:phoneNumbersRequest" />
  </wsdl:message>
  <wsdl:portType name="DialerResponseServicePortType">
    <wsdl:operation name="errorNotification">
      <wsdl:input wsaw:Action="urn:errorNotification" message="ns:errorNotificationRequest" />
    </wsdl:operation>
    <wsdl:operation name="runHostStartRequest">
      <wsdl:input wsaw:Action="urn:runHostStartRequest" message="ns:runHostStartRequestRequest" />
    </wsdl:operation>
    <wsdl:operation name="agentStatus">
      <wsdl:input wsaw:Action="urn:agentStatus" message="ns:agentStatusRequest" />
    </wsdl:operation>
    <wsdl:operation name="dialedNumber">
      <wsdl:input wsaw:Action="urn:dialedNumber" message="ns:dialedNumberRequest" />
    </wsdl:operation>
    <wsdl:operation name="outboundCallConnection">
      <wsdl:input wsaw:Action="urn:outboundCallConnection" message="ns:outboundCallConnectionRequest" />
    </wsdl:operation>
    <wsdl:operation name="phoneNumbersRequest">
      <wsdl:input wsaw:Action="urn:phoneNumbersRequest" message="ns:phoneNumbersRequestRequest" />
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="DialerResponseServiceSoap11Binding" type="ns:DialerResponseServicePortType">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
    <wsdl:operation name="runHostStartRequest">
      <soap:operation soapAction="urn:runHostStartRequest" style="document" />
      <wsdl:input>
        <soap:body use="literal" />
      </wsdl:input>
    </wsdl:operation>
    <wsdl:operation name="errorNotification">
      <soap:operation soapAction="urn:errorNotification" style="document" />
      <wsdl:input>
        <soap:body use="literal" />
      </wsdl:input>
    </wsdl:operation>
    <wsdl:operation name="agentStatus">
      <soap:operation soapAction="urn:agentStatus" style="document" />
      <wsdl:input>
        <soap:body use="literal" />
      </wsdl:input>
    </wsdl:operation>
    <wsdl:operation name="outboundCallConnection">
      <soap:operation soapAction="urn:outboundCallConnection" style="document" />
      <wsdl:input>
        <soap:body use="literal" />
      </wsdl:input>
    </wsdl:operation>
    <wsdl:operation name="dialedNumber">
      <soap:operation soapAction="urn:dialedNumber" style="document" />
      <wsdl:input>
        <soap:body use="literal" />
      </wsdl:input>
    </wsdl:operation>
    <wsdl:operation name="phoneNumbersRequest">
      <soap:operation soapAction="urn:phoneNumbersRequest" style="document" />
      <wsdl:input>
        <soap:body use="literal" />
      </wsdl:input>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:binding name="DialerResponseServiceSoap12Binding" type="ns:DialerResponseServicePortType">
    <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
    <wsdl:operation name="runHostStartRequest">
      <soap12:operation soapAction="urn:runHostStartRequest" style="document" />
      <wsdl:input>
        <soap12:body use="literal" />
      </wsdl:input>
    </wsdl:operation>
    <wsdl:operation name="errorNotification">
      <soap12:operation soapAction="urn:errorNotification" style="document" />
      <wsdl:input>
        <soap12:body use="literal" />
      </wsdl:input>
    </wsdl:operation>
    <wsdl:operation name="agentStatus">
      <soap12:operation soapAction="urn:agentStatus" style="document" />
      <wsdl:input>
        <soap12:body use="literal" />
      </wsdl:input>
    </wsdl:operation>
    <wsdl:operation name="outboundCallConnection">
      <soap12:operation soapAction="urn:outboundCallConnection" style="document" />
      <wsdl:input>
        <soap12:body use="literal" />
      </wsdl:input>
    </wsdl:operation>
    <wsdl:operation name="dialedNumber">
      <soap12:operation soapAction="urn:dialedNumber" style="document" />
      <wsdl:input>
        <soap12:body use="literal" />
      </wsdl:input>
    </wsdl:operation>
    <wsdl:operation name="phoneNumbersRequest">
      <soap12:operation soapAction="urn:phoneNumbersRequest" style="document" />
      <wsdl:input>
        <soap12:body use="literal" />
      </wsdl:input>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:binding name="DialerResponseServiceHttpBinding" type="ns:DialerResponseServicePortType">
    <http:binding verb="POST" />
    <wsdl:operation name="runHostStartRequest">
      <http:operation location="DialerResponseService/runHostStartRequest" />
      <wsdl:input>
        <mime:content part="runHostStartRequest" type="text/xml" />
      </wsdl:input>
    </wsdl:operation>
    <wsdl:operation name="errorNotification">
      <http:operation location="DialerResponseService/errorNotification" />
      <wsdl:input>
        <mime:content part="errorNotification" type="text/xml" />
      </wsdl:input>
    </wsdl:operation>
    <wsdl:operation name="agentStatus">
      <http:operation location="DialerResponseService/agentStatus" />
      <wsdl:input>
        <mime:content part="agentStatus" type="text/xml" />
      </wsdl:input>
    </wsdl:operation>
    <wsdl:operation name="outboundCallConnection">
      <http:operation location="DialerResponseService/outboundCallConnection" />
      <wsdl:input>
        <mime:content part="outboundCallConnection" type="text/xml" />
      </wsdl:input>
    </wsdl:operation>
    <wsdl:operation name="dialedNumber">
      <http:operation location="DialerResponseService/dialedNumber" />
      <wsdl:input>
        <mime:content part="dialedNumber" type="text/xml" />
      </wsdl:input>
    </wsdl:operation>
    <wsdl:operation name="phoneNumbersRequest">
      <http:operation location="DialerResponseService/phoneNumbersRequest" />
      <wsdl:input>
        <mime:content part="phoneNumbersRequest" type="text/xml" />
      </wsdl:input>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="DialerResponseService">
    <wsdl:port name="DialerResponseServiceHttpSoap11Endpoint" binding="ns:DialerResponseServiceSoap11Binding">
      <soap:address location="http://192.168.233.1:8989/axis/services/DialerResponseService.DialerResponseServiceHttpSoap11Endpoint/" />
    </wsdl:port>
    <wsdl:port name="DialerResponseServiceHttpSoap12Endpoint" binding="ns:DialerResponseServiceSoap12Binding">
      <soap12:address location="http://192.168.233.1:8989/axis/services/DialerResponseService.DialerResponseServiceHttpSoap12Endpoint/" />
    </wsdl:port>
    <wsdl:port name="DialerResponseServiceHttpEndpoint" binding="ns:DialerResponseServiceHttpBinding">
      <http:address location="http://192.168.233.1:8989/axis/services/DialerResponseService.DialerResponseServiceHttpEndpoint/" />
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>
 
 
SOAP:
POST /axis/services/DialerResponseService.DialerResponseServiceHttpSoap11Endpoint/ HTTP/1.1
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 2.0.50727.3053)
Content-Type: text/xml; charset=utf-8
SOAPAction: "urn:phoneNumbersRequest"
Host: localhost:8989
Content-Length: 859
Expect: 100-continue
 
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<phoneNumbersRequest xmlns="http://service.dialer.css.com">
<inputRequest>
<destinationSystemId xmlns="http://data.dialer.css.com/xsd">2
</destinationSystemId>
<internalMessageId xmlns="http://data.dialer.css.com/xsd" />
<operationType xsi:nil="true" xmlns="http://data.dialer.css.com/xsd" />
<sourceSystemId xmlns="http://data.dialer.css.com/xsd">1
</sourceSystemId>
<campaignId xmlns="http://data.dialer.css.com/xsd">CSS-011
</campaignId>
<stringernalReasonId xsi:nil="true" xmlns="http://data.dialer.css.com/xsd" />
<testNumber xsi:nil="true" xmlns="http://data.dialer.css.com/xsd" />
</inputRequest>
</phoneNumbersRequest>
</soap:Body>
</soap:Envelope>
POST /axis/services/DialerResponseService.DialerResponseServiceHttpSoap11Endpoint/ HTTP/1.1
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 2.0.50727.3053)
Content-Type: text/xml; charset=utf-8
SOAPAction: "urn:phoneNumbersRequest"
Host: localhost:8989
Content-Length: 859
Expect: 100-continue

Open in new window

0
Comment
Question by:SoCalKen99
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 

Accepted Solution

by:
SoCalKen99 earned 0 total points
ID: 22892409
I have determined the solution to this issue.  When non-string class members are not marked as required, an additional xxxSpecified companion Boolean member is generated for each such member.  For instance, if a class contains an optional Int32 member named 'retries', when a WSDL is generated, the WSDL definition for the class will contain the 'retries' Int32 member and a 'retriesSpecified' Boolean member.

When using the class auto-generated from the WSDL, it is necessary to set both the retries member and the retriesSpecified member in order for the retries member to be serialized to the SOAP message.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are two main kinds of selectors in CSS: One is base selector like h1, h2, body, table or any existing HTML tags.  For instance, the following rule sets all paragraphs (<p> elements) to red: (CODE) CSS also allows us to define our own custom …
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question