Loading ...
Sorry, an error occurred while loading the content.

Axis interop with .NET webservice help - value getting dropped

Expand Messages
  • anil_krish
    I am having an interop problem with Apache Axis client and .NET C# webservice. I know i am doing something wrong but my Values are getting dropped (getting a
    Message 1 of 4 , Aug 3, 2002
    • 0 Attachment
      I am having an interop problem with Apache Axis client and .NET C#
      webservice.

      I know i am doing something wrong but my Values are getting dropped
      (getting a null value) at .NET service.

      Here is what being sent from my Apache Axis Java client

      POST /commportal/StringTest.asmx HTTP/1.0
      Host: localhost
      Content-Type: text/xml; charset=utf-8
      SOAPAction: "http://tempuri.org/getCustomerId"
      Content-Length: 522
      <?xml version="1.0" encoding="UTF-8"?>
      <soapenv:Envelope
      soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-
      ENC="http://schemas.xmlsoap.org/soap/encoding/">
      <soapenv:Body>
      <ns1:getCustomerId xmlns:ns1="http://tempuri.org">
      <incoming xsi:type="xsd:string">working</incoming>
      </ns1:getCustomerId>
      </soapenv:Body>
      </soapenv:Envelope>

      This is what my .NET C# webservice code is expecting

      POST /commportal/StringTest.asmx HTTP/1.1
      Host: localhost
      Content-Type: text/xml; charset=utf-8
      Content-Length: length
      SOAPAction: "http://tempuri.org/getCustomerId"

      <?xml version="1.0" encoding="utf-8"?>
      <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
      <soap:Body>
      <getCustomerId xmlns="http://tempuri.org/">
      <incoming>string</incoming>
      </getCustomerId>
      </soap:Body>
      </soap:Envelope>


      Here is my Java code

      public class StringTest {

      public static void main(String[] args) throws Exception {

      Service service = new Service();
      Call call = (Call) service.createCall();

      String endpoint
      = "http://localhost:90/commportal/StringTest.asmx";

      call.setTargetEndpointAddress(new URL(endpoint));

      call.setUseSOAPAction(true);
      call.setSOAPActionURI
      ("http://tempuri.org/getCustomerId");

      call.setOperationName(new QName
      ("http://tempuri.org", "getCustomerId"));

      call.addParameter("incoming", XMLType.XSD_STRING,
      ParameterMode.IN);

      call.setReturnType(XMLType.XSD_STRING);

      System.out.println("Call Soap action " +
      call.getSOAPActionURI());

      String answer =
      (String) call.invoke(new Object[] { new String
      ("working")});

      System.out.println("Got Result:" + answer);

      }
      }

      Both OPERATION_STYLE_PROPERTY and SEND_TYPE_ATTR properties did not
      help

      what am i doing wrong can someone point me in right direction. I
      would greatly appreciate help.

      Thanks Much

      Anil

      If it helps here is the response i am getting back from .NET

      HTTP/1.1 200 OK

      Server: Microsoft-IIS/5.0

      Date: Sun, 04 Aug 2002 00:08:04 GMT

      Cache-Control: private, max-age=0

      Content-Type: text/xml; charset=utf-8

      Content-Length: 381



      <?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>
      <getCustomerIdResponse xmlns="http://tempuri.org/">
      <getCustomerIdResult>Hello World test
      </getCustomerIdResult>
      </getCustomerIdResponse>
      </soap:Body>
      </soap:Envelope>

      Notice that my incoming string is missing.
    • Sam Ruby
      ... The namespaces don t match on incoming. The easiest fix is to add the following to your C# code, immediately before the class. ... Alternatively, use
      Message 2 of 4 , Aug 3, 2002
      • 0 Attachment
        anil_krish wrote:
        > I am having an interop problem with Apache Axis client and .NET C#
        > webservice.
        >
        > I know i am doing something wrong but my Values are getting dropped
        > (getting a null value) at .NET service.
        >
        > Here is what being sent from my Apache Axis Java client
        > <ns1:getCustomerId xmlns:ns1="http://tempuri.org">
        > <incoming xsi:type="xsd:string">working</incoming>
        > </ns1:getCustomerId>
        >
        > This is what my .NET C# webservice code is expecting
        > <getCustomerId xmlns="http://tempuri.org/">
        > <incoming>string</incoming>
        > </getCustomerId>

        The namespaces don't match on incoming. The easiest fix is to add the
        following to your C# code, immediately before the class.

        > using System.Web.Services.Protocols;
        > [SoapRpcService]

        Alternatively, use Axis's WSDL2Java to generate a client stub from the
        WSDL that ASP.NET generates.

        - Sam Ruby
      • Grahame Grieve
        Hi I m just playing catch up, and working through round #1. Initially, I am working through the examples at http://www.xmethods.net/soapbuilders/proposal.html
        Message 3 of 4 , Aug 12, 2002
        • 0 Attachment
          Hi

          I'm just playing catch up, and working through
          round #1. Initially, I am working through the
          examples at
          http://www.xmethods.net/soapbuilders/proposal.html

          there appears to be an error in the example message
          for echoStringArrayResponse, echoIntegerArrayResponse
          and echoFloatArrayResponse, that the return type
          is "namesp1:Array" not "SOAP-ENC:Array". However it
          may be that I misunderstand the spec, and that namesp1:Array
          is a valid way to indicate Array encoding?

          Grahame
        • Wes Moulder
          The prefix used for a namespace doesn t matter, the only important thing is that they re bound to the same namespace. (However from looking at it, that seems
          Message 4 of 4 , Aug 12, 2002
          • 0 Attachment
            Message
            The prefix used for a namespace doesn't matter, the only important thing is that they're bound to the same namespace.  (However from looking at it, that seems to be in error since they aren't bound to the same namespace).  I believe most of Round 1 has been deprecated by Round 2 anyway.  Most new entries into the interop game simply start with Round 2 [1].
             
            Hope that helps,
            --Wes
             
            -----Original Message-----
            From: Grahame Grieve [mailto:grahame@...]
            Sent: Monday, August 12, 2002 7:18 AM
            To: soapbuilders@yahoogroups.com
            Subject: [soapbuilders] Error in Round 1 examples?

            Hi

            I'm just playing catch up, and working through
            round #1. Initially, I am working through the
            examples at
            http://www.xmethods.net/soapbuilders/proposal.html

            there appears to be an error in the example message
            for echoStringArrayResponse, echoIntegerArrayResponse
            and echoFloatArrayResponse, that the return type
            is "namesp1:Array" not "SOAP-ENC:Array". However it
            may be that I misunderstand the spec, and that namesp1:Array
            is a valid way to indicate Array encoding?

            Grahame




            -----------------------------------------------------------------
            This group is a forum for builders of SOAP implementations to discuss implementation and interoperability issues.  Please stay on-topic.

            To unsubscribe from this group, send an email to:
            soapbuilders-unsubscribe@yahoogroups.com



            Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
          Your message has been successfully submitted and would be delivered to recipients shortly.