4 Replies Latest reply on Jan 3, 2005 1:00 PM by Thomas Diesler

    Problem in passing parameters to .NET web service

    Prasanna Newbie

      Hi Thomas

      I am trying to invoke .NET WS from Java Axis client. I am able to invoke the
      WS but not able to pass parameters. In .NET it is receiving as null for
      sting. I searched the forum and found that AXIS by default uses RPC and .NET
      by default is Document. So If we force the .NET to use RPC the problem will
      be solved. I gave [SoapRpcService] in .NET WS and i saw the WSDL it is
      mentioned as

      - <wsdl:binding name="Service1Soap" type="tns:Service1Soap">
      <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc"
      />
      - <wsdl:operation name="HelloWorld">
      <soap:operation soapAction="http://tempuri.org/Rpc" style="rpc" />
      - <wsdl:input>
      <soap:body use="encoded" namespace="http://tempuri.org/HelloWorld"
      encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
      </wsdl:input>
      - <wsdl:output>
      <soap:body use="encoded" namespace="http://tempuri.org/HelloWorld"
      encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
      </wsdl:output>
      </wsdl:operation>
      </wsdl:binding>

      Earlier it was Document now it is RPC. Now my problem is java client is not
      working it is throwing exception.
      AxisFault
      faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Client
      faultSubcode:
      faultString: Server was unable to read request. --> There is an error in
      XML
      document (4, 4). --> &lt;HelloWorld xmlns=&apos;&apos;&gt; was
      not e
      xpected.
      faultActor:
      faultNode:
      faultDetail:
      {http://xml.apache.org/axis/}stackTrace: AxisFault
      faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Client
      faultSubcode:
      faultString: Server was unable to read request. --&gt; There is an
      error in
      XML document (4, 4). --&gt; &amp;lt;HelloWorld
      xmlns=&apos;&apo
      s;&amp;gt; was not expected.
      faultActor:
      faultNode:
      faultDetail:

      Please help me to fix the problem.


      Thanks in Advance
      Prasanna

        • 1. Re: Problem in passing parameters to .NET web service
          Thomas Diesler Master

          How is this related to JBoss.NET?

          You can turn on debugging for org.apache.axis to get a better understanding of what is going on.

          • 2. Re: Problem in passing parameters to .NET web service
            Prasanna Newbie

            Hi Thomas

            I am using Apache Axis for Java client to access the .NET web service. I am able to invoke the .NET WS but i am not able to pass the parameters. In the .NET WS the parameters are received as NULL values. I searched the internet and found that AXIS uses SOAP RPC encodying style and .NET by default uses Document/Literal. I changed that also in the .NET WS. I dont know what else i have to do in the .NET side since i dont have any idea in .NET.

            I am pasting my Java client here

            import org.apache.axis.client.Call;
            import org.apache.axis.client.Service;

            import javax.xml.namespace.QName;
            import javax.xml.rpc.ParameterMode;
            import org.apache.axis.encoding.XMLType;
            import org.apache.axis.description.OperationDesc;
            import org.apache.axis.message.RPCElement;

            public class WSClient
            {
            public static void main(String [] args) throws Exception
            {
            System.out.println("Before WEB SERVICE");
            String endpoint = "http://eproindia28/createsubscription-WS/Service1.asmx";
            Service service = new Service();
            Call call = (Call) service.createCall();
            call.setTargetEndpointAddress( new java.net.URL(endpoint) );
            call.setOperationName("HelloWorld");
            System.out.println("---------5--------------");
            call.setSOAPActionURI("http://tempuri.org/HelloWorld");
            call.addParameter("strRet", org.apache.axis.Constants.XSD_STRING, ParameterMode.IN);
            call.setReturnClass(String.class);

            System.out.println("-----6--getMessageContext()------------"+call.getMessageContext());
            System.out.println("-----6--getOperation() ------------"+call.getOperation() );
            System.out.println("-----6--getPortName() ------------"+call.getPortName());
            System.out.println("-----6--getSOAPActionURI()------------"+call.getSOAPActionURI());
            System.out.println("-----6--getUsername()------------"+call.getUsername());
            System.out.println("-----6--getEncodingStyle()------------"+call.getEncodingStyle());
            System.out.println("-----6--getService()------------"+call.getService());
            System.out.println("-----6--getOperationName()------------"+call.getOperationName());
            System.out.println("-----6--getWSDLDocumentLocation()------------"+service.getWSDLDocumentLocation() );

            try
            {
            String strTemp = (String)call.invoke( new Object[] {"HI prasanna this is a test input to the .NET WS"});
            System.out.println("---------strTemp--------------"+strTemp);
            }
            catch (Exception e)
            {
            e.printStackTrace();
            }
            System.out.println("AFTER WEB SERVICE --->");
            }
            }

            Please tell me where i am going wrong...

            Thanks in Advance
            Prasanna

            • 3. Re: Problem in passing parameters to .NET web service
              Prasanna Newbie

              Hi Thomas

              Can you please tell me how to turn on debugging in AXIS?

              Thanks
              Prasanna

              • 4. Re: Problem in passing parameters to .NET web service
                Thomas Diesler Master

                 

                 <category name="org.apache.axis">
                 <priority value="DEBUG"/>
                 </category>
                


                in ${jboss.server.conf.dir}/log4j.xml