You need to specify that the return type is xsd:double.
(You've currently defined it as tns:getPriceResult)
Anne
On 10/25/06, Andrew P. <[EMAIL PROTECTED]> wrote:
Hello there!
Actually, my "call" object does not recognise the "setEncodingStyleURI"
method...
But I read that this do the same (sets the operations to document/literal):
call.setProperty("javax.xml.rpc.encodingstyle.namespace.uri",
"");
call.setProperty(Call.OPERATION_STYLE_PROPERTY, "document");
The error I'm getting is:
the serializer/deserializer for parameter number: 0, named:
"{http://tempuri.org/}getPriceResult", type:
"{http://tempuri.org/}getPriceResult", is ambiguous because
its class could not be determined
Thanks in advance for the help!
Andrew
----- Original Message -----
From: Martin Gainty
To: [email protected]
Sent: Tuesday, October 24, 2006 6:13 PM
Subject: Re: Dynamic Invocation Problem (Axis works, but .NET...)
Andrew-
Look at code C of this page
http://mail-archives.apache.org/mod_mbox/ws-soap-dev/200202.mbox/[EMAIL
PROTECTED]
the most important statement is to set the call style to doc literal as in
this example
call.setEncodingStyleURI
(org.apache.axis2.Constants.SOAP_STYLE_LITERAL_WRAPPED);
HTH
Martin
This e-mail communication and any attachments may contain confidential and
privileged information for the use of the
designated recipients named above. If you are not the intended recipient,
you are hereby notified that you have received
this communication in error and that any review, disclosure, dissemination,
distribution or copying of it or its
contents
----- Original Message -----
From: Andrew P.
To: [email protected]
Sent: Tuesday, October 24, 2006 4:12 PM
Subject: Dynamic Invocation Problem (Axis works, but .NET...)
Hello! I'm trying to invoke a service dynamically using DII - without
previsouly generating any proxy.
With Axis (which is rpc/encoded style) is working fine, but with a .NET
(document/literal) is not working. Anybody has worked with something
similar, and have any idea?
I have attached the code and the WSDL(of the .NET service):
public class GetAllMethods_Price {
private static String ENCODING_STYLE_PROPERTY =
"javax.xml.rpc.encodingstyle.namespace.uri";
private static String TYPE_NAMESPACE_VALUE = "http://tempuri.org/";
public static void main (String args[]) {
try {
String serviceUrl =
"http://localhost/GetPrice/Service.asmx";
URL wsdlURL = new URL(serviceUrl + "?WSDL");
ServiceFactory serviceFactory = ServiceFactory.newInstance();
QName serviceQname = new QName(TYPE_NAMESPACE_VALUE, "Service");
Service servicow = serviceFactory.createService(wsdlURL,serviceQname);
Call call = servicow.createCall();
call.setTargetEndpointAddress("http://localhost/GetPrice/Service.asmx");
call.setProperty(Call.SOAPACTION_USE_PROPERTY, new Boolean(true));
call.setProperty(Call.SOAPACTION_URI_PROPERTY,"");
call.setProperty("javax.xml.rpc.encodingstyle.namespace.uri",
"");
call.setProperty(Call.OPERATION_STYLE_PROPERTY, "document");
QName REQUEST_QNAME = new QName(TYPE_NAMESPACE_VALUE, "getPrice");
call.addParameter("item", REQUEST_QNAME, ParameterMode.IN);
QName RESPONSE_QNAME = new QName(TYPE_NAMESPACE_VALUE, "getPriceResult");
call.setReturnType(RESPONSE_QNAME);
Object[] Arguments = {new String("keyboard")};
Object price = call.invoke(Arguments);
System.out.println("Item price: " + price.toString());
} catch (Exception ex) {
ex.printStackTrace();
}
}
--------------------
<?xml version="1.0" encoding="utf-8" ?>
- <wsdl:definitions
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:tns="http://tempuri.org/"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
targetNamespace="http://tempuri.org/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
- <wsdl:types>
- <s:schema elementFormDefault="qualified"
targetNamespace="http://tempuri.org/">
- <s:element name="getPrice">
- <s:complexType>
- <s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="item" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
- <s:element name="getPriceResponse">
- <s:complexType>
- <s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="getPriceResult"
type="s:double" />
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</wsdl:types>
- <wsdl:message name="getPriceSoapIn">
<wsdl:part name="parameters" element="tns:getPrice" />
</wsdl:message>
- <wsdl:message name="getPriceSoapOut">
<wsdl:part name="parameters" element="tns:getPriceResponse" />
</wsdl:message>
- <wsdl:portType name="ServiceSoap">
- <wsdl:operation name="getPrice">
<wsdl:input message="tns:getPriceSoapIn" />
<wsdl:output message="tns:getPriceSoapOut" />
</wsdl:operation>
</wsdl:portType>
- <wsdl:binding name="ServiceSoap" type="tns:ServiceSoap">
<soap:binding
transport="http://schemas.xmlsoap.org/soap/http" />
- <wsdl:operation name="getPrice">
<soap:operation soapAction="http://tempuri.org/getPrice" style="document"
/>
- <wsdl:input>
<soap:body use="literal" />
</wsdl:input>
- <wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
- <wsdl:binding name="ServiceSoap12" type="tns:ServiceSoap">
<soap12:binding
transport="http://schemas.xmlsoap.org/soap/http" />
- <wsdl:operation name="getPrice">
<soap12:operation soapAction="http://tempuri.org/getPrice"
style="document" />
- <wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
- <wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
- <wsdl:service name="Service">
- <wsdl:port name="ServiceSoap" binding="tns:ServiceSoap">
<soap:address
location="http://localhost/GetPrice/Service.asmx" />
</wsdl:port>
- <wsdl:port name="ServiceSoap12" binding="tns:ServiceSoap12">
<soap12:address
location="http://localhost/GetPrice/Service.asmx" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
__________ Informa��o do NOD32 IMON 1.1831 (20061024) __________
Esta mensagem foi verificada pelo NOD32 sistema antiv�rus
http://www.eset.com.br