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> </wsdl:types> <wsdl:part name="parameters"
element="tns:getPrice" /> </wsdl:message> <wsdl:part name="parameters"
element="tns:getPriceResponse" />
</wsdl:message> <wsdl:input message="tns:getPriceSoapIn" /> <wsdl:output message="tns:getPriceSoapOut" />
</wsdl:operation> </wsdl:portType> <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
</wsdl:binding> <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
</wsdl:binding> </wsdl:definitions> |
- Dynamic Invocation Problem (Axis works, but .NET...) Andrew P.
- Re: Dynamic Invocation Problem (Axis works, but .NE... Martin Gainty
- Re: Dynamic Invocation Problem (Axis works, but... Andrew P.
- Re: Dynamic Invocation Problem (Axis works,... Anne Thomas Manes