title: Calling a Java Web Service from a .Net Project
body: <p>I hoping you guys can help me. </p>
  
  <p>I am a .Net developer using C# code.  I have been given the task to call a web service written in Java by my colleague. The first problem we have is he doesn’t speak .Net and I don’t speak Java. </p>
  
  <p>The first question is whether to using a web reference or a service reference. Both seem to work in the sense that my program can find the service and add the reference. But the Service Reference is not exposed in my project. For this reason I went with the Web reference at least for now. </p>
  
  <p>I can set any of the properties and recall them and it works fine. The question I have is how to invoke the method. When I ask my colleague he does not seem to get what I am talking about. </p>
  
  <p>I need the answer if it’s something simply or if I need to ask a question my colleague in a way that a Java person will understand what I’m talking about. </p>
  
  <p>Here is the code I have written:</p>
  
  <pre><code>WebReference.getContactUs myContactUs = new WebReference.getContactUs();
  
          myContactUs.ContactUsReceived = DateTime.Now;
          myContactUs.FirstName = "Bob";
          myContactUs.LastName = "Avallone";
          DateTime _ThisDateTime = myContactUs.ContactUsReceived;
  </code></pre>
  
  <p>Here is the code from the wsdl</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://contactus.nrcme.fmcsa.dot.gov/" xmlns:ns1="http://nrcme.fmcsa.dot.gov/ContactUs/" name="ContactUs" targetNamespace="http://nrcme.fmcsa.dot.gov/ContactUs/" xmlns="http://schemas.xmlsoap.org/wsdl/"&gt;
    &lt;types&gt;
      &lt;xs:schema targetNamespace="http://nrcme.fmcsa.dot.gov/ContactUs/" version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt;
        &lt;xs:element name="getContactUs"&gt;
          &lt;xs:complexType&gt;
            &lt;xs:sequence&gt;
              &lt;xs:element name="ContactUsReceived" type="xs:dateTime" /&gt;
              &lt;xs:element name="FirstName" type="xs:string" /&gt;
              &lt;xs:element name="LastName" type="xs:string" /&gt;
              &lt;xs:element name="Title" type="xs:string" /&gt;
              &lt;xs:element name="Organization" type="xs:string" /&gt;
              &lt;xs:element name="Address1" type="xs:string" /&gt;
              &lt;xs:element name="Address2" type="xs:string" /&gt;
              &lt;xs:element name="City" type="xs:string" /&gt;
              &lt;xs:element name="State" type="xs:string" /&gt;
              &lt;xs:element name="ZipCode" type="xs:string" /&gt;
              &lt;xs:element name="Telephone" type="xs:string" /&gt;
              &lt;xs:element minOccurs="0" name="Fax" type="xs:string" /&gt;
              &lt;xs:element name="Email" type="xs:string" /&gt;
              &lt;xs:element name="EmailConfirm" type="xs:string" /&gt;
              &lt;xs:element minOccurs="0" name="Comment" type="xs:string" /&gt;
              &lt;xs:element minOccurs="0" name="Question1" type="xs:string" /&gt;
            &lt;/xs:sequence&gt;
          &lt;/xs:complexType&gt;
        &lt;/xs:element&gt;
        &lt;xs:element name="getContactUsResponse"&gt;
          &lt;xs:complexType&gt;
            &lt;xs:sequence&gt;
              &lt;xs:element name="ContactUsReceived" type="xs:dateTime" /&gt;
              &lt;xs:element minOccurs="0" name="status" type="xs:string" /&gt;
            &lt;/xs:sequence&gt;
          &lt;/xs:complexType&gt;
        &lt;/xs:element&gt;
      &lt;/xs:schema&gt;
    &lt;/types&gt;
    &lt;message name="ContactUs_getContactUsResponse"&gt;
      &lt;part name="getContactUsResponse" element="ns1:getContactUsResponse" /&gt;
    &lt;/message&gt;
    &lt;message name="ContactUs_getContactUs"&gt;
      &lt;part name="getContactUs" element="ns1:getContactUs" /&gt;
    &lt;/message&gt;
    &lt;portType name="ContactUs"&gt;
      &lt;operation name="getContactUs" parameterOrder="getContactUs"&gt;
        &lt;input message="ns1:ContactUs_getContactUs" /&gt;
        &lt;output message="ns1:ContactUs_getContactUsResponse" /&gt;
      &lt;/operation&gt;
    &lt;/portType&gt;
    &lt;binding name="ContactUsBinding" type="ns1:ContactUs"&gt;
      &lt;soap:binding transport="http://schemas.xmlsoap.org/soap/http" /&gt;
      &lt;operation name="getContactUs"&gt;
        &lt;soap:operation soapAction="http://nrcme.fmcsa.dot.gov/ContactUs/getContactUs" /&gt;
        &lt;input&gt;
          &lt;soap:body use="literal" /&gt;
        &lt;/input&gt;
        &lt;output&gt;
          &lt;soap:body use="literal" /&gt;
        &lt;/output&gt;
      &lt;/operation&gt;
    &lt;/binding&gt;
  &lt;/definitions&gt;
  </code></pre>
  
  <p>Thanks in advance, this forum has been great.</p>