Here's a small test case.

- Echo.wsdl : the original WSDL file.
- Echo.java : the implementation class (server).
- TestEcho : a client to test the deployed service.
- deploy.wsdd : the deployment file generated with WSDL2Java, and modified (className and <namespace>)


If you want to test you have to :
- generate the server stubs : java org.apache.axis.wsdl.WSDL2Java --server-side Echo.wsdl
- compile them and Echo.java to your container directory (WEB-INF/classes).
- deploy the service with deploy.wsdd
- save the 2 generated WSDLs (http://127.0.0.1:8080/axis/servlet/AxisServlet)
- generate the client stubs with WSDL2Java on these 2 WSDLs, and compile them
- compile and run the client


The client can call "echo1" but can't find "echo2", whereas these services are similar.
There is one port, one binding and one service per method.


Best regards,
Olivier


Olivier Gauwin wrote:


Hi,

I've try to use the --server-side option of WSDL2Java to generate the deploy.wsdd file.

It works in almost every case (I just have to add a <namespace> tag and to change the className parameter). I've just one service where it doesn't work, because when it's deployed with this generated deploy.wsdd, the server sends a "No such operation 'myMethod'" back to the client.

However it worked with my own deploy.wsdd file and I don't find the reason why it fails. It seems related to the fact that there are 2 services in the WSDL file, but it works with another one containing 2 services too.

I've searched in the source code, and found that the instruction "rm.getSOAPEnvelope().getFirstBody();" in AxisServlet (line 304) normally initializes the operation in the message context, but not with the failing deploy.wsdd.

If someone has an idea, it would be welcomed.
Otherwise I'll post a bug report.

Thanks
Olivier





<?xml version="1.0" encoding="UTF-8"?>

<definitions
    targetNamespace="urn:Echo"
    xmlns:tns="urn:Echo"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema";
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
    xmlns="http://schemas.xmlsoap.org/wsdl/";
>


  <message name="echo1Request">
      <part name="inputEcho1" type="xsd:int"/>
  </message>
  <message name="echo1Response">
      <part name="_return" type="xsd:int"/>
  </message>

  <message name="echo2Request">
      <part name="inputEcho2" type="xsd:int"/>    
  </message>
  <message name="echo2Response">
      <part name="_return2" type="xsd:int"/>
  </message>


<portType name="Port1">
    <operation name="echo1">
        <input  message="tns:echo1Request"/>
        <output message="tns:echo1Response"/>
    </operation>
</portType>

<portType name="Port2">
    <operation name="echo2">
        <input  message="tns:echo2Request"/>
        <output message="tns:echo2Response"/>
    </operation>
</portType>

  <binding name="Port1Binding"
      type="tns:Port1">
    <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
    <operation name="echo1">
      <operation soapAction="Port1#echo1"/>
      <input>
          <soap:body
              encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
              namespace="urn:Echo"
              use="encoded"/>
      </input>
      <output>
          <soap:body
              encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
              namespace="urn:Echo"
              use="encoded"/>
      </output>
    </operation>
  </binding>

  <binding name="Port2Binding"
      type="tns:Port2">
    <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
    <operation name="echo2">
      <operation soapAction="Port2#echo2"/>
      <input>
          <soap:body
              encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
              namespace="urn:Echo"
              use="encoded"/>
      </input>
      <output>
          <soap:body
              encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
              namespace="urn:Echo"
              use="encoded"/>
      </output>
    </operation>
  </binding>

  <service name="Echo1Service">
    <port binding="tns:Port1Binding"
        name="Echo1Service">
        <soap:address
            location="http://192.168.199.72:8080/axis/services/Echo1Service"/>
    </port>
  </service>
  <service name="Echo2Service">
    <port binding="tns:Port2Binding"
        name="Echo2Service">
        <soap:address
            location="http://192.168.199.72:8080/axis/services/Echo2Service"/>
    </port>
  </service>
</definitions>
public class Echo {

    public int echo1(int inputEcho1) {
        return inputEcho1;
    }

    public int echo2(int inputEcho2) {
        return inputEcho2;
    }

}
<!-- Use this file to deploy some handlers/chains and services      -->
<!-- Two ways to do this:                                           -->
<!--   java org.apache.axis.client.AdminClient deploy.wsdd          -->
<!--      after the axis server is running                          -->
<!-- or                                                             -->
<!--   java org.apache.axis.utils.Admin client|server deploy.wsdd   -->
<!--      from the same directory that the Axis engine runs         -->

<deployment
    xmlns="http://xml.apache.org/axis/wsdd/";
    xmlns:java="http://xml.apache.org/axis/wsdd/providers/java";>

  <!-- Services from Echo1Service WSDL service -->

  <service name="Echo1Service" provider="java:RPC" style="rpc" use="encoded">
      <namespace>urn:Echo</namespace>
      <parameter name="wsdlTargetNamespace" value="urn:Echo"/>
      <parameter name="wsdlServiceElement" value="Echo1Service"/>
      <parameter name="wsdlServicePort" value="Echo1Service"/>
      <parameter name="className" value="Echo"/>
      <parameter name="wsdlPortType" value="Port1"/>
      <operation name="echo1" qname="operNS:echo1" xmlns:operNS="urn:Echo" 
returnQName="_return" returnType="rtns:int" 
xmlns:rtns="http://www.w3.org/2001/XMLSchema"; >
        <parameter name="inputEcho1" type="tns:int" 
xmlns:tns="http://www.w3.org/2001/XMLSchema"/>
      </operation>
      <parameter name="allowedMethods" value="echo1"/>

  </service>

  <!-- Services from Echo2Service WSDL service -->

  <service name="Echo2Service" provider="java:RPC" style="rpc" use="encoded">
      <namespace>urn:Echo</namespace>
      <parameter name="wsdlTargetNamespace" value="urn:Echo"/>
      <parameter name="wsdlServiceElement" value="Echo2Service"/>
      <parameter name="wsdlServicePort" value="Echo2Service"/>
      <parameter name="className" value="Echo"/>
      <parameter name="wsdlPortType" value="Port2"/>
      <operation name="echo2" qname="operNS:echo2" xmlns:operNS="urn:Echo" 
returnQName="_return2" returnType="rtns:int" 
xmlns:rtns="http://www.w3.org/2001/XMLSchema"; >
        <parameter name="inputEcho2" type="tns:int" 
xmlns:tns="http://www.w3.org/2001/XMLSchema"/>
      </operation>
      <parameter name="allowedMethods" value="echo2"/>

  </service>
</deployment>
import Echo.*;

import org.apache.axis.AxisFault;

import org.apache.axis.utils.JavaUtils;
import org.apache.axis.utils.Options;


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

        TestEcho client = new TestEcho();
        String url = "http://192.168.199.72:8080/axis/servlet/AxisServlet";;
        
        Echo.Port1 binding1 = new Echo1ServiceLocator().getEcho1Service(new 
java.net.URL(url));
        Echo.Port2 binding2 = new Echo2ServiceLocator().getEcho2Service(new 
java.net.URL(url));
        
        ((Echo1ServiceSoapBindingStub)binding1).setTimeout(30000);
        ((Echo2ServiceSoapBindingStub)binding2).setTimeout(30000);

        try {
                int res = binding1.echo1(3);
                System.out.println("echo1: sent:3 received:" + res);
                int res2 = binding2.echo2(3);
                System.out.println("echo2: sent:3 received:" + res2);
        } catch (org.apache.axis.AxisFault e) {
                System.out.println(e.toString());
        }
    }
}

Reply via email to