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 -----
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/">
- <s:schema elementFormDefault="qualified"
targetNamespace="http://tempuri.org/">
- <s:element name="getPrice">
<s:element minOccurs="0"
maxOccurs="1"
name="item"
type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
- <s:element name="getPriceResponse">
<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" />
<soap:body use="literal" />
</wsdl:input>
<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" />
<soap12:body use="literal" />
</wsdl:input>
<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>