Rather than defining two different portTypes, each with its own associated binding, define one portType and one binding with two operations.
Anne
On 6/21/06, Stefan Kuhn <[EMAIL PROTECTED]> wrote:
Hi all,
I have a web service, described via a wsdl. I deployed this, but it seems
only one method is recognized. When I go to
http://127.0.0.1:8080/axis/servlet/AxisServlet , only the doPrediction method
is listed, but not getSpectrumTypes. Furthermore when using my client, always
the doPrediction method is executed. I put in the relevant file, if you need
any other information, please ask.
The wsdl:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/ "
xmlns:tns="http://www.nmrshiftdb.org/ws/NMRShiftDB/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/ "
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:cml="http://www.xml-cml.org/schema"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
name="NMRShiftDB"
targetNamespace=" http://www.nmrshiftdb.org/ws/NMRShiftDB/">
<wsdl:types>
<xsd:schema
targetNamespace="http://www.nmrshiftdb.org/ws/NMRShiftDB/ "
xmlns:cml="http://www.xml-cml.org/schema">
<xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/ " />
<xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" />
<xsd:import namespace=" http://www.w3.org/2001/XMLSchema" />
<xsd:import
namespace="http://www.xml-cml.org/schema"
schemaLocation=" http://almost.cubic.uni-koeln.de/schema.xsd" />
<xsd:element
name="doPredictionResponse"
type="cml:spectrumTypeType" />
<xsd:element
name="doPredictionRequest"
type="tns:DoPredictionParameters" />
<xsd:complexType name="DoPredictionParameters">
<xsd:sequence>
<xsd:element
ref="cml:molecule"
minOccurs="1"
maxOccurs="1" />
<xsd:element
name="spectrumTypeName"
type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</wsdl:types>
<wsdl:message name="doPredictionResponse">
<wsdl:part
element="tns:doPredictionResponse"
name="doPredictionResponse" />
</wsdl:message>
<wsdl:message name="doPredictionRequest">
<wsdl:part
element="tns:doPredictionRequest"
name="doPredictionRequest" />
</wsdl:message>
<wsdl:message name="getSpectrumTypesResponse">
<wsdl:part
type="xsd:string"
name="getSpectrumTypesResponse" />
</wsdl:message>
<wsdl:portType name="NMRShiftDB">
<wsdl:operation name="doPrediction">
<wsdl:input message="tns:doPredictionRequest" />
<wsdl:output message="tns:doPredictionResponse" />
</wsdl:operation>
</wsdl:portType>
<wsdl:portType name="NMRShiftDBOneWay">
<wsdl:operation name="getSpectrumTypes">
<wsdl:output message="tns:getSpectrumTypesResponse"></wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding
name="NMRShiftDBSOAP"
type="tns:NMRShiftDB">
<soap:binding
style="document"
transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="doPrediction">
<soap:operation
soapAction=" http://www.nmrshiftdb.org/axis/services/NMRShiftDB?method=doPredi
ction" /> <wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding
name="NMRShiftDBOneWaySOAP"
type="tns:NMRShiftDBOneWay">
<soap:binding
style="document"
transport=" http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="getSpectrumTypes">
<soap:operation
soapAction=" http://www.nmrshiftdb.org/ws/NMRShiftDB/getSpectrumTypes" />
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="NMRShiftDB">
<wsdl:port
binding="tns:NMRShiftDBSOAP"
name="NMRShiftDBSOAP">
<soap:address
location="http://almost.cubic.uni-koeln.de/axis/services/NMRShiftDB" />
</wsdl:port>
<wsdl:port
binding="tns:NMRShiftDBOneWaySOAP"
name="NMRShiftDBOneWaySOAP">
<soap:address
location="http://almost.cubic.uni-koeln.de/axis/services/NMRShiftDB " />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
The wsdd:
<deployment
xmlns="http://xml.apache.org/axis/wsdd/ "
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
<!-- Services from serviceName WSDL service -->;
<service name="NMRShiftDB" provider="java:MSG" use="literal">
<!-- Definitions for the SOAPMonitor (optional) -->
<!--<requestFlow>
<handler type="soapmonitor"/>
</requestFlow>
<responseFlow>
<handler type="soapmonitor"/>
</responseFlow>-->
<!-- End of the definitions for the SOAPMonitor -->
<parameter name="className"
value=" org.openscience.nmrshiftdb.webservices.NMRShiftDBServiceBindingImpl"/>
<parameter name="allowedMethods" value="*"/>
<wsdlFile>NMRShiftDB.wsdl</wsdlFile>
</service>
</deployment>
Finally my client code which should call getSpectrumTypes. It calls
doPrediction actually:
public void testGetSpectrumTypes() throws Exception{
Options opts = new Options(new String[0]);
// Modify it to the location of your service
opts.setDefaultURL("http://"+server+"/axis/services/NMRShiftDB");
Service service = new Service();
Call call = (Call) service.createCall ();
call.setOperationName("getSpectrumTypes");
call.setTargetEndpointAddress( new URL(opts.getURL()) );
DocumentBuilder builder;
builder =
DocumentBuilderFactory.newInstance().newDocumentBuilder();
SOAPBodyElement[] input = new SOAPBodyElement[1];
Document doc = builder.newDocument();
Element cdataElem;
cdataElem =
doc.createElementNS("http://www.nmrshiftdb.org/ws/NMRShiftDB/ ",
"getSpectrumTypes");
Element reqElem;
reqElem =
doc.createElementNS("http://www.nmrshiftdb.org/ws/NMRShiftDB/",
"spectrumTypeName");
Node node;
node = doc.createTextNode("13C");
reqElem.appendChild(node);
String filename = "org/openscience/nmrshiftdb/tests/butadiene.cml";
InputStream ins =
this.getClass().getClassLoader().getResourceAsStream(filename);
Document document = builder.parse(ins);
Node
nodeimp=doc.importNode(document.getChildNodes().item(0),true);
cdataElem.appendChild(nodeimp);
cdataElem.appendChild(reqElem);
input[0] = new SOAPBodyElement(cdataElem);
System.out.println(input[0].toString());
Vector elems = (Vector) call.invoke( input );
SOAPBodyElement elem = null ;
Element e = null ;
elem = (SOAPBodyElement) elems.get(0);
e = elem.getAsDOM();
System.err.println(XMLUtils.ElementToString(e));
assertEquals(1,e.getChildNodes().getLength());
}
It would be great if you could help me with this problem
Stefan
--
Stefan Kuhn M. A.
Cologne University BioInformatics Center (http://www.cubic.uni-koeln.de)
Zülpicher Str. 47, 50674 Cologne
Tel: +49(0)221-470-7428 Fax: +49 (0) 221-470-7786
My public PGP key is available at http://pgp.mit.edu
-------------------------------------------------------
--
Stefan Kuhn M. A.
Cologne University BioInformatics Center ( http://www.cubic.uni-koeln.de)
Zülpicher Str. 47, 50674 Cologne
Tel: +49(0)221-470-7428 Fax: +49 (0) 221-470-7786
My public PGP key is available at http://pgp.mit.edu
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]