You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Jeff Greif <jg...@alumni.princeton.edu> on 2002/09/20 17:47:45 UTC

wsdl question

I've hit (and worked around) a problem with a WSDL-described web service,
and cannot tell at the moment whether the problem is with the WSDL
description or with WSIF/Axis.  If the latter, I'll cheerfully submit a bug
report.

I'm working with a WSIF client program derived from the DynamicInvoker
sample.  In using the WSDL below, specifying the URL to the wsdl file and
the operation name only (not port, input message or output message) I got
this exception:

Exception in thread "main" org.apache.wsif.WSIFException: Could not create
operation: getNucSeq:getNucSeq:getNucSeqRespo
nse
        at
org.apache.wsif.providers.soap.apachesoap.WSIFPort_ApacheSOAP.createOperatio
n(Unknown Source)
        at MyDynamicInvoker.invokeMethod(MyDynamicInvoker.java:280)
        at MyDynamicInvoker.main(MyDynamicInvoker.java:168)

until I commented out the line marked WRONG??? below and replaced it by the
line following.  From the WSDL spec, I cannot confirm that the commented-out
line is actually wrong; it seems more likely that the name attribute of the
operation input element is a free choice of the implementer, unrelated to
the message attribute.

Is the WSDL file really broken in its original form, or is the change
necessitated by some deficiency of Axis or WSIF WSDL machinery (or this
client program)?  I think this question boils down to the relationship of
the attributes (in XPath notation)
/definitions/portType/operation/input/@message and
/definitions/portType/operation/input/@name to the
/definitions/message/@name identifying a message.  The input@message
attribute is supposed to match message@name, but is message@name or
input@name the desired argument to WSIFPort.createOperation()?

The relevant code snippet was:
        ...
        Definition def = WSIFUtils.readWSDL(null, wsdlLocation);

        System.out.println("Preparing WSIF dynamic invocation");

        Service service = WSIFUtils.selectService(def, serviceNS,
serviceName);
        PortType portType = WSIFUtils.selectPortType(def, portTypeNS,
portTypeName);

        WSIFServiceFactory factory = WSIFServiceFactory.newInstance();
        WSIFService dpf = factory.getService(def, service, portType);
        WSIFPort port = null;
        if (portName == null)
            port = dpf.getPort();
        else if (portTypeName != null) {  // local part of name, no NS
     System.err.println("Getting port with local name part "
          + portTypeName);
            port = dpf.getPort(portTypeName);
 } else {
            port = dpf.getPort(portName);
 }


        if (inputName == null && outputName == null) {
            // retrieve list of operations
            List operationList = portType.getOperations();

            // try to find input and output names for the operation
specified
            boolean found = false;
            for (Iterator i = operationList.iterator(); i.hasNext();) {
                Operation op = (Operation) i.next();
                String name = op.getName();
                if (!name.equals(operationName)) {
                    continue;
                }
                if (found) {
                    throw new RuntimeException(
            "Operation '"
            + operationName
            + "' is overloaded. "
            + "Please specify the operation in the form "
            + "'operationName:inputMessageName:outputMesssageName' to
distinguish it");
                }
                found = true;
                Input opInput = op.getInput();
                inputName = (opInput.getName() == null) ? null :
opInput.getName();
                Output opOutput = op.getOutput();
                outputName = (opOutput.getName() == null) ? null :
opOutput.getName();
            }
        }

        WSIFOperation operation =
            port.createOperation(operationName, inputName, outputName);
        ...

with null values supplied for serviceNS, serviceName, portTypeNS,
portTypeName, portName, inputName and outputName, and the value "getNucSeq"
for operationName.


Jeff

-------corrected? version of  http://www.ebi.ac.uk/xembl/XEMBL.wsdl --------
<definitions name="XEMBL" targetNamespace="http://www.ebi.ac.uk/XEMBL"
xmlns:tns="http://www.ebi.ac.uk/XEMBL"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns="http://schemas.xmlsoap.org/wsdl/">
  <documentation>Documentation of this Web Service, together with a sample
client and links to Bsml (Labbook, Inc.) and AGAVE (DoubleTwist, Inc.) can
be found at the European Bioinformatics Institute
http://www.ebi.ac.uk/xembl/</documentation>
<message name="getNucSeqRequest" xmlns:tns="http://www.ebi.ac.uk/XEMBL">
<part name="format" type="xsd:string">
  <documentation>Input parameter that indicates the result format that
should be returned. Legit values: Bsml or sciobj. Defaults to Bsml if format
not recognised.</documentation>
  </part>
<part name="ids" type="xsd:string">
  <documentation>A space delimited list of international Nucleotide Sequence
accession numbers (IDs). For example: "HSERPG U83300 AC000057". Minimum
number of IDs is 1.</documentation>
  </part>
  </message>
<message name="getNucSeqResponse">
<part name="result" type="xsd:string">
  <documentation>An XML formatted result in either Bsml or AGAVE
format.</documentation>
  </part>
  </message>
<portType name="XEMBLPortType">
<operation name="getNucSeq">
  <!-- <input message="tns:getNucSeqRequest" name="getNucSeq" />
WRONG???-->
  <input message="tns:getNucSeqRequest" name="getNucSeqRequest" />
  <output message="tns:getNucSeqResponse" name="getNucSeqResponse" />
  </operation>
  </portType>
<binding name="XEMBLServiceBinding" type="tns:XEMBLPortType">
  <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"
/>
<operation name="getNucSeq">
  <soap:operation soapAction="http://www.ebi.ac.uk/XEMBL#getNucSeq" />
<input>
  <soap:body use="encoded" namespace="http://www.ebi.ac.uk/XEMBL"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
  </input>
<output>
  <soap:body use="encoded" namespace="http://www.ebi.ac.uk/XEMBL"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
  </output>
  </operation>
  </binding>
<service name="XEMBLService">
  <documentation>Returns full information on EMBL Nucleotide Sequences
formatted as Bsml XML or Agave XML. I.e. returns sequence itself,
cross-references, taxonomy, literature, full feature information,
etc.</documentation>
<port name="XEMBLPort" binding="tns:XEMBLServiceBinding">
  <soap:address
location="http://www.ebi.ac.uk:80/cgi-bin/xembl/XEMBL-SOAP.pl" />
  </port>
  </service>
  </definitions>