No SOAPAction in dynamic proxy client

I am trying to consume a .NET Web service from a J2EE client. I am using a dynamic proxy client from http://java.sun.com/webservices/docs/1.3/tutorial/doc/JAXRPC5.html#wp79973
However, I am have a problem with the SOAPAction HTTP header. .NET requires this header element to be set but the proxy sends an empty SOAPAction header. What is the solution to this problem?

message.getHeaders().addHeader("SoapAction","http://some.action.here");
this piece of code is not working. This what i'm using.
my .net service is running at ""http://192.168.4.214/dmwebservice/service1.asmx";" and my method name is "disconnect_cabinet"
mesg.getMimeHeaders().addHeader("POST" , " /dmwebservice/service1.asmx HTTP/1.1");
mesg.getMimeHeaders().addHeader("HOST" , " http://192.168.4.214");
mesg.getMimeHeaders().addHeader("SOAPAction", " http://tempuri.org/disconnect_cabinet");
the request & response is:
[java] **** request ****
[java] <?xml version="1.0" encoding="utf-8"?>
[java] <SOAP-ENV:Envelope soap:encodingStyle="http://schemas.xmlsoap.org/so
ap/encoding" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xs
d="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema
-instance"><SOAP-ENV:Header><SOAPAction xmlns="http://192.168.4.214/dmwebservice
/service1.asmx/disconnect_cabinet"/></SOAP-ENV:Header><SOAP-ENV:Body><disconnect
_cabinet xmlns="http://tempuri.org/"><credentials>123456</credentials></disconne
ct_cabinet></SOAP-ENV:Body></SOAP-ENV:Envelope>
[java] **** response ****
[java] <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="htt
p://schemas.xmlsoap.org/soap/envelope/"><soap:Header><wsu:Timestamp xmlns:wsu="h
ttp://schemas.xmlsoap.org/ws/2002/07/utility"><wsu:Created>2004-06-28T05:00:50Z<
/wsu:Created><wsu:Expires>2004-06-28T05:05:50Z</wsu:Expires></wsu:Timestamp></so
ap:Header><soap:Body><soap:Fault><faultcode>soap:Client</faultcode><faultstring>
System.Web.Services.Protocols.SoapHeaderException: The message is not a valid XM
L message ---> System.Xml.XmlException: 'soap' is an undeclared namespace. Li
ne 2, position 20.
[java] at System.Xml.XmlNSAttributeTokenInfo.FixNames()
[java] at System.Xml.XmlTextReader.ParseElement()
[java] at System.Xml.XmlTextReader.Read()
[java] at Microsoft.Web.Services.XmlSkipDTDReader.Read()
[java] at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc)
[java] at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, B
oolean preserveWhitespace)
[java] at System.Xml.XmlDocument.Load(XmlReader reader)
[java] at Microsoft.Web.Services.SoapEnvelope.Load(Stream stream)
[java] at Microsoft.Web.Services.WebServicesExtension.BeforeDeserializeS
erver(SoapMessage message)
what does this means and how can i fix? "The message is not a valid XML message ---> System.Xml.XmlException: 'soap' is an undeclared namespace. Line 2, position 20."
please let me know.
subhani.

Similar Messages

  • Dynamic proxy client error

    hello,
    im running a dynamic proxy client for a simple web service. I have the web service up and running but when i run the client i get the following error:
    run-client:
    [java] java.lang.NoClassDefFoundError: dynamicproxy/BookClient
    [java] Exception in thread "main"
    [java] Java Result: 1
    run:
    BUILD SUCCESSFUL
    Total time: 2 seconds
    My client code is as follows:
    package dynamicproxy;
    import java.net.URL;
    import javax.xml.rpc.Service;
    import javax.xml.rpc.JAXRPCException;
    import javax.xml.namespace.QName;
    import javax.xml.rpc.ServiceFactory;
    import dynamicproxy.BookIF;
    public class BookClient{
    public static void main(String[] args){
    try{
    String UrlString = args[0] + "?WSDL";
    String nameSpaceUri = "urn:Foo";
    String serviceName = "MyBookService";
    String portName = "BookIFPort";
    System.out.println("UrlString = " + UrlString);
    URL bookWsdlUrl = new URL(UrlString);
    ServiceFactory serviceFactory = ServiceFactory.newInstance();
                   Service bookService = serviceFactory.createService(bookWsdlUrl,
                   new QName(nameSpaceUri, serviceName));
    dynamicproxy.BookIF
    myProxy = (dynamicproxy.BookIF)
    bookService.getPort(new QName(nameSpaceUri, portName),
    dynamicproxy.BookIF.class);
                   System.out.println("The sum of the 2 numbers is:");
    System.out.println(myProxy.add(1, 2));
    catch (Exception ex)
    ex.printStackTrace();
    Any ideas??

    thnx kwalsh1 i got it working. It was the targets.xml file in jaxrpc/common, i edited the package-dynamic to include all class files!

  • Dynamic Proxy Client

    Hi all,
    iam trying to use the dynamic proxy client with the following lines
    String UrlString =
    "http://localhost:8080/ProxyHelloWorld.wsdl";
    String nameSpaceUri = "http://proxy.org/wsdl";
    String serviceName = "HelloWorld";
    String portName = "HelloIFPort";
    URL helloWsdlUrl = new URL(UrlString);
    ServiceFactory serviceFactory =
    ServiceFactory.newInstance();
    Service helloService =
    serviceFactory.createService(helloWsdlUrl,
    new QName(nameSpaceUri, serviceName));
    //HelloIF myProxy = (HelloIF) helloService.getPort(
    //new QName(nameSpaceUri, portName),
    //proxy.HelloIF.class);
    when i try to do this i get the following exception
    Exception in thread "main" java.lang.NoSuchMethodError
    at com.sun.xml.rpc.wsdl.parser.Util.verifyTagNSRootElement(Util.java:59)
    at com.sun.xml.rpc.wsdl.parser.WSDLParser.parseDefinitionsNoImport(WSDLP
    arser.java:191)
    at com.sun.xml.rpc.wsdl.parser.WSDLParser.parseDefinitionsNoImport(WSDLP
    arser.java:165)
    at com.sun.xml.rpc.wsdl.parser.WSDLParser.parseDefinitions(WSDLParser.ja
    va:96)
    at com.sun.xml.rpc.wsdl.parser.WSDLParser.parse(WSDLParser.java:91)
    at com.sun.xml.rpc.processor.modeler.wsdl.WSDLModeler.buildModel(WSDLMod
    eler.java:85)
    at com.sun.xml.rpc.processor.config.ModelInfo.buildModel(ModelInfo.java:
    77)
    at com.sun.xml.rpc.client.dii.ServiceInfoBuilder.getModel(ServiceInfoBui
    lder.java:96)
    at com.sun.xml.rpc.client.dii.ServiceInfoBuilder.buildServiceInfo(Servic
    eInfoBuilder.java:59)
    at com.sun.xml.rpc.client.dii.ConfiguredService.<init>(ConfiguredService
    .java:44)
    at com.sun.xml.rpc.client.ServiceFactoryImpl.createService(ServiceFactor
    yImpl.java:32)
    at JAXRPCClient.main(JAXRPCClient.java:38)
    what am i doing wrong
    suresh

    Hi,
    Yeah the Wsdl is hosted at http://localhost:8080/ProxyHelloWorld.wsdl.I also tried binding with a few xmethods service i get the same error.
    same error.

  • JAX-RPC Dynamic Proxy Client Question

    I have a very simple web service successfully deployed using Tomcat 5 and Apache Axis. It simply takes a string and returns a String. Regardless, it's working.
    Now I'm wanting to create a JAX-RPC dynamic proxy client as described on the following page:
    http://java.sun.com/webservices/docs/1.3/tutorial/doc/JAXRPC5.html
    There are numerous other articles out there describing the same method.
    My problem is that I'm getting a ServiceException on the following line every time I try to run my client:
    ServiceFactory factory = ServiceFactory.newInstance();
    Would anyone have any ideas why this might be or what I might be missing? All the articles make it seem like this is just a trivial line and never mention much about it.
    Any help would be appreciated. Thanks.

    Hello,
    You are getting a service Exception on ServiceFactory.newInstance() method?
    Actually, I have never seen this problem before. Is it possible that there are
    classpath issues? That is, are you using just the jars from the jwsdp?
    Regards,
    Kathy

  • How to make a dynamic proxy client in Java ME?

    Hi guys!
    I have an existing static stub web service client to WCF made by generating client stub feature of the Netbeans. How do I make this into a dynamic proxy?

    tsubaki.pw wrote:
    I have an existing static stub web service client to WCF. How do I make this into a dynamic proxy?What is the WCF?

  • Running Dynamic Proxy Client

    Hi all,
    I followed the web services devcloper pack tutorial and examples and was able to run the Proxy HelloClient example with the "ant run" command. But when I was trying to call it using >java I get
    C:\java\jwsdp-1_0_01\docs\tutorial\examples\jaxrpc\proxy>java -classpath dist/proxy-client.jar;%CLASSPATH%;. proxy.HelloClient
    Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/rpc/ServiceFactory
    at proxy.HelloClient.main(Unknown Source)
    Shouldn't javax be in my Win (yes running Window 2000) env classpath already?
    Also, I want to take this client code to a different machine (client) to run this to see if it can find the server for the remote calling. What files (.class, .xml, etc.) do I need to copy to the client machine to run it?
    thanks

    Hi,
    I wanted to know the answer for the follg. question you had asked.
    Kindly reply incase you know about it.
    I want to take this client code to a different
    machine (client) to run this to see if it can find the
    server for the remote calling. What files (.class,
    .xml, etc.) do I need to copy to the client machine to
    run it?
    thanks

  • Dynamic proxy invokes basic auth web service

    My dynamic proxy client works fine with any web service except the basic auth secured one.
    I know how to use stub client to work around this issue. But I haven't found a way to get around when dynamic proxy clients are used.
    Any idea is appricated. Thanks

    Paula-
    Given that you can work around this issue with the stub client,
    you should be able to work around the issue in the dynamic proxy client
    in the same way-
    I am interested that you say workaround the issue with the stub client.
    Is there a problem that you have noted?
    If you can let me know how you worked this issue with the stub,
    and what problems you have specifically had with the dynamic proxy client
    I will look at the issue to see if it a bug.
    Please let me know what environment you are working in, the version of jaxrpc 1.x,
    what container, jdk or jre and a sample client program that would help me understand
    the problem.
    Thanks,
    Kathy

  • Async Dynamic Proxy Patented!

    Hi,
    I needed to make a call to send an email asynchronous, to remove it from the critical path. This is so that when the user hits a 'submit' button for an application on a web page, the server does not take a long time to respond, when it is busy sending the email, which can take a few seconds sometimes.
    Easy to do, but then I thought, why don't I write a dynamic proxy that makes any method call asynchronous and add that to my library of useful stuff. Googled "java dynamic proxy asynchronous method call", and found that IBM have patented it:
    http://www.google.com/patents/US7519977
    For real? Ok, I know there are even worse patents than that.
    Anyone have an idea of how different my implementation of this would need to be to avoid being covered by the the patent?

    Paula-
    Given that you can work around this issue with the stub client,
    you should be able to work around the issue in the dynamic proxy client
    in the same way-
    I am interested that you say workaround the issue with the stub client.
    Is there a problem that you have noted?
    If you can let me know how you worked this issue with the stub,
    and what problems you have specifically had with the dynamic proxy client
    I will look at the issue to see if it a bug.
    Please let me know what environment you are working in, the version of jaxrpc 1.x,
    what container, jdk or jre and a sample client program that would help me understand
    the problem.
    Thanks,
    Kathy

  • Dynamic Proxy - RAD

    Hello All,
    I'm a newbie to Web Services...I was trying to create a client using dynamic proxy in Rational Application Developer ...can anyone help me with a nice example or a tutorial
    Help is greatly appreciated
    Thanks.

    Paula-
    Given that you can work around this issue with the stub client,
    you should be able to work around the issue in the dynamic proxy client
    in the same way-
    I am interested that you say workaround the issue with the stub client.
    Is there a problem that you have noted?
    If you can let me know how you worked this issue with the stub,
    and what problems you have specifically had with the dynamic proxy client
    I will look at the issue to see if it a bug.
    Please let me know what environment you are working in, the version of jaxrpc 1.x,
    what container, jdk or jre and a sample client program that would help me understand
    the problem.
    Thanks,
    Kathy

  • Why cannot execute DB operation at client side with dynamic proxy?

    I want to execute a DB operation at client side with dynamic proxy. that is bypass EJBs to execute DB operation. And there is a data source in weblogic server, and I get an EJB instance using dynamic proxy, get connection using this instance, then invoke executeQuery method. But it is failed, and throw exception when execute "conn.setAutoCommit(false)" as below:
    <Caused by: weblogic.rmi.extensions.RemoteRuntimeException: Unexpected Exception - with nested exception:
    [java.rmi.UnmarshalException: Could not unmarshal method ID; nested exception is:
    java.rmi.UnmarshalException: Method not found: 'newArrayDataResultSet(Loracle.sql.ARRAY;JILjava.util.Map;)']
    at weblogic.jdbc.rmi.internal.ConnectionImpl_weblogic_jdbc_wrapper_PoolConnection_oracle_jdbc_driver_OracleConnection_813_WLStub.setAutoCommit(Unknown Source)
    at weblogic.jdbc.rmi.SerialConnection_weblogic_jdbc_rmi_internal_ConnectionImpl_weblogic_jdbc_wrapper_PoolConnection_oracle_jdbc_driver_OracleConnection_813_WLStub.setAutoCommit(Unknown Source)>
    but it is no exception and run well using EJB, who can tell me why? if it is a weblogic limitation? and my version of WLS is 8.1 sp3

    Hi,
    Do you create the connection object on the server and pass it over to the client, we do not allow passing the connection object over the wire.

  • Dynamic proxy not working

    Folks,
    I deployed a EJB Webservice(Document Literal) in Sun App Server. I am able to access the method through Static Stub but Dynamic proxy says the below error:
    port: {http://com.venkat.webservice/AllInOne/targ}AllInOneIntfPort does not contain operation: justConcat
         at com.sun.xml.rpc.client.dii.ConfiguredCall.configureCall(ConfiguredCall.java:98)
         at com.sun.xml.rpc.client.dii.ConfiguredCall.configureCall(ConfiguredCall.java:69)
         at com.sun.xml.rpc.client.dii.ConfiguredCall.setMethodName(ConfiguredCall.java:50)
         at com.sun.xml.rpc.client.dii.DynamicProxyBuilder.buildDynamicProxyFor(DynamicProxyBuilder.java:66)
         at com.sun.xml.rpc.client.dii.ConfiguredService.getPort(ConfiguredService.java:250)
         at wsclient.DynProxy.main(DynProxy.java:50)
    The Code i used to access is as below:
    String UrlString = "http://venkat:8080/AllInOneServiceBean" + "?WSDL";
                String nameSpaceUri = "http://com.venkat.webservice/AllInOne/targ";
                String serviceName = "AllInOneService";
                String portName = "AllInOneIntfPort";
      Service helloService =
                    serviceFactory.createService(helloWsdlUrl,
                        new QName(nameSpaceUri, serviceName));
    AllInOneIntf myProxy = (AllInOneIntf) helloService.getPort(new QName(
                        nameSpaceUri,
                        portName), AllInOneIntf.class);          
                System.out.println(myProxy.justConcat("aasds","as"));The WSDL File is:
    <?xml version="1.0" encoding="UTF-8"?><definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://com.venkat.webservice/AllInOne/targ" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ns2="http://com.venkat.webservice/AllInOne/type" name="AllInOneService" targetNamespace="http://com.venkat.webservice/AllInOne/targ">
    <types>
    <schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://com.venkat.webservice/AllInOne/type" xmlns:soap11-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://com.venkat.webservice/AllInOne/type">
    <complexType name="justConcat">
    <sequence>
    <element name="String_1" type="string" nillable="true"/>
    <element name="String_2" type="string" nillable="true"/></sequence></complexType>
    <complexType name="justConcatResponse">
    <sequence>
    <element name="result" type="string" nillable="true"/></sequence></complexType>
    <complexType name="takeCustomObject">
    <sequence>
    <element name="ValueObject_1" type="tns:ValueObject" nillable="true"/></sequence></complexType>
    <complexType name="ValueObject">
    <sequence>
    <element name="comp" type="string" nillable="true"/>
    <element name="name" type="string" nillable="true"/></sequence></complexType>
    <complexType name="takeCustomObjectResponse">
    <sequence>
    <element name="result" type="string" nillable="true"/></sequence></complexType>
    <element name="justConcat" type="tns:justConcat"/>
    <element name="justConcatResponse" type="tns:justConcatResponse"/>
    <element name="takeCustomObject" type="tns:takeCustomObject"/>
    <element name="takeCustomObjectResponse" type="tns:takeCustomObjectResponse"/></schema></types>
    <message name="AllInOneIntf_justConcat">
    <part name="parameters" element="ns2:justConcat"/></message>
    <message name="AllInOneIntf_justConcatResponse">
    <part name="result" element="ns2:justConcatResponse"/></message>
    <message name="AllInOneIntf_takeCustomObject">
    <part name="parameters" element="ns2:takeCustomObject"/></message>
    <message name="AllInOneIntf_takeCustomObjectResponse">
    <part name="result" element="ns2:takeCustomObjectResponse"/></message>
    <portType name="AllInOneIntf">
    <operation name="justConcat">
    <input message="tns:AllInOneIntf_justConcat"/>
    <output message="tns:AllInOneIntf_justConcatResponse"/></operation>
    <operation name="takeCustomObject">
    <input message="tns:AllInOneIntf_takeCustomObject"/>
    <output message="tns:AllInOneIntf_takeCustomObjectResponse"/></operation></portType>
    <binding name="AllInOneIntfBinding" type="tns:AllInOneIntf">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
    <operation name="justConcat">
    <soap:operation soapAction=""/>
    <input>
    <soap:body use="literal"/></input>
    <output>
    <soap:body use="literal"/></output></operation>
    <operation name="takeCustomObject">
    <soap:operation soapAction=""/>
    <input>
    <soap:body use="literal"/></input>
    <output>
    <soap:body use="literal"/></output></operation></binding>
    <service name="AllInOneService">
    <port name="AllInOneIntfPort" binding="tns:AllInOneIntfBinding">
    <soap:address location="http://venkat:8080/AllInOneServiceBean" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"/></port></service></definitions>
    Please let me what mistake i am doing if any? or is this a bug
    Thanks
    Venkat

    If you are using document/literal, which this WSDL is, you would be much better off using Metro (JAX-WS) as it has a much better dynamic interface in the Dispatch APIs. Metro: http://metro.dev.java.net, JAX-WS: http://jax-ws.dev.java.net.

  • Jax-ws: dynamic proxy-suppress weblogic's default ws-policy handling

    hi all,
    i am writing my own jax-ws client (dynamic proxy) to call a web service, secured by usernametoken profile.
    the wsdl of the web service do include the ws-policy information.
    sample client side code:
    URL url = new URL("path_to_wsdl_file");
    QName serviceQname = new QName("http://model/", "CalculationService");
    Service service = Service.create(url, serviceQname);
    //add resolver and jax-ws handler to add username token SOAPElement fragment to the SOAP message.
    the above code runs fine in J2SE 6.0 environment (without any weblogic-specific library).
    but when i run the above code in a servlet (running in weblogic), the above code fails with the following error:
    Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Unable to add security token for identity, token uri =http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken
    at com.sun.xml.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java:196)
    at com.sun.xml.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:122)
    at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:119)
    at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:89)
    at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:118)
    at $Proxy23.add(Unknown Source)
    at client.ServiceLocator.main(ServiceLocator.java:32)
    it seems that the weblogic server will try to handle the ws-policy element (according to those in the wsdl), even though
    i have already added the username-token security header by my own code.
    As i don't add some weblogic-specific code (e.g. weblogic.wsee.security.unt.ClientUNTCredentialProvider), the web service call fails.
    is it possible to disable/suppress such behavior (weblogic runtime handle the ws-policy element) per web service call???
    (i don't want a server scope solution, as there may be other web service client running on the same weblogic server that rely on such behavior).
    i don't want to use weblogic's API (e.g. ClientUNTCredentialProvider) as i want my web service client be portable (username token is easy to be handled by my own code)
    thank you.

    Hi René ,
    i just use plain HTTP, not HTTPS.
    seems don't involve any certificate, am i right?
    in J2SE environment, i can run the webservice client without problem.
    but once i run the client in weblogic, the problem mentioned occurred.
    if i manually delete the ws-policy related tag in the wsdl file (i download it to local filesystem for testing), the client can run in weblogic too.
    so, think there is some setting in weblogic that try to handle the ws-policy by its so-called 'credential provider'(e.g. ClientUNTCredentialProvider ?)
    thank you.

  • Any example of dynamic proxy with RMI?

    Hi, are there any good example of dynamic proxy with RMI, using the new RemoteObjectInvocationHandler class?
    I am currently implementing a Registry, and want to use dynamic proxy to wrap around the registry stub, to pass extra information to the client.
    I've tried it, but the program will hang and get this exception:
    Exception in thread "RMI TCP Connection(1616)-192.168.1.23" java.lang.OutOfMemoryError: Java heap space
    My implementation looks like this:
    public RegistryImpl extends RemoteServer Implements Registry {
        public RegistryImpl(int port, Properties... properties) throws RemoteException, ChannelException {
             // Create a reference for the registry.
         LiveRef liveref = new LiveRef(id, port);
            ref = new UnicastServerRef(liveref);
             Registry proxy = (Registry)RegistryProxy.newProxyInstance(
                  this.getClass().getClassLoader(),
                  this.getClass().getInterfaces(),
                  new RemoteObjectInvocationHandler(this.getRef()));
             /* Using dynamic proxy */
             usref.exportObject(proxy, null, true);
    public class RegistryProxy extends Proxy implements Registry {
         private InvocationHandler handler;
         public RegistryProxy(InvocationHandler handler) {
              super(handler);
              this.handler = handler;
         public Remote lookup(String name) throws RemoteException, NotBoundException, AccessException {
              Remote result;
              try {
                   Method m = Registry.class.getMethod("lookup", new Class[]{String.class});
                   result = (Remote)handler.invoke(this, m, new Object[]{name});
              } catch (SecurityException e) {
                   throw new UndeclaredThrowableException(e);
              } catch (NoSuchMethodException e) {
                   throw new UndeclaredThrowableException(e);
              } catch (Throwable e) {
                   throw new UndeclaredThrowableException(e);
              return result;
         public void bind(String name, Remote remoteObj) throws RemoteException, AlreadyBoundException, AccessException {
         public void unbind(String name) throws RemoteException, NotBoundException, AccessException {
         public void rebind(String name, Remote remoteObj) throws RemoteException, AccessException {
         public String[] list() throws RemoteException, AccessException {
    }I am new to Java programming, any help is appriciated.
    Regards
    Eddie

    Hi Eddie,
    Perhaps you might like this one:
    http://wiki.java.net/bin/view/Communications/TransparentProxy
    it uses dynamic proxies to achieve complete RMI transparency.
    Something to consider, good luck.
    John

  • Dynamic Webservices Client

    Hey ,
    I have an application which requires to talk to 2 different published webservices
    from 2 different systems. Now instead od designing static webservice clients for
    each of these systems(which would involve having separate proxy jars etc),
    I am planning to design a dynamic webservice locator and invoker....
    I know that we can have webservice clients which are dynamic to the extent that
    we can create proxy objects at runtime once we know the endpoint WSDL..
    eg:
    ServiceFactory factory = ServiceFactory.newInstance();
    QName serviceName =new QName targetNamespace,"net.xmethods.services.stockquote.StockQuoteService");
    QName portName = new QName(targetNamespace,"net.xmethods.services.stockquote.StockQuotePort");
    QName operationName = new QName("urn:xmethods-delayed-quotes","getQuote");
    URL wsdlLocation = new URL("http://services.xmethods.net/soap/urn:xmethods-delayed-quotes.wsdl");
    // create service
    Service service = factory.createService(wsdlLocation, serviceName);
    // create call Call call = service.createCall(portName, operationName);
    My question on this...if I have a dynamic approach like the above what are the
    pros and cons..I guess it would surely have more overhead compared to a static
    client...?
    Secondly ,is it even feasible to design a dynamic client in such a way that the
    endpoint WSDL could also be an unknown and my generic client would also locate
    the end-point dynamically and then invoke dynamic calls as above...
    If anybody can share their insights on a dynamic webservice client , I would really
    appreciate it...
    Thanx,
    Krish
    KRISH.VENKATARAMAN
    Senior Technology Analyst
    Bank of America Corp.
    Email:[email protected]

    Hi Krish,
    In WSDL, the data types passed between applications are described in schema
    and
    this is key for interop. I dont know of any standard/natural mapping for
    values types,
    object reference, etc in a binary protocol (like JRMP, IIOP) to schema. For
    eg:
    say there is serializable object Foo, which is the argument to a remote
    method in RMI.
    Object Foo can have data + behavior. It may be possible (not always, i
    think) to
    describe the data in Foo as schema, but how can one describe the behavior?
    So, if WSDL is the only contract between the server and client (key
    requirement
    for interop), then IMHO RMI can not be described by WSDL.
    Also, WSDL was designed for future extensions and does not map well to a
    programming API. WSIF trys to expose all the gory WSDL details and its apis
    are very clumsy.
    These were the two main reason to vote it down at JAX-RPC EC.
    I am attaching an example that shows, how to introspect WSDL and invoke
    a method using JAX-RPC (with little extension to the std api). Also, it
    shows
    how to handle complex type without data binding. Will this solve your
    problem?
    I am very interested to get your feedback on this.
    BTW, This example will only work with WLS 8.1.
    regards,
    -manoj
    "Krish Venkataraman" <[email protected]> wrote in message
    news:[email protected]...
    >
    >
    Mike...thanx for the inputs...
    As per ur suggestion...I have taken this offline and mailed u [email protected]
    also....lemme know if thatz cool...
    there are my observations..lemme know what am i missing..
    1) The main difference I see between JAX-RPC and WSIF, is that with WSIFclient
    it is easier to port to services talking
    via other ports like RMI,IIOP etc...where as JAX-RPC is understandsonly SOAP(atleast
    for now).
    2) Lets assume for the time-being that I would be interested only to talkto services
    talking SOAP.
    Then why do I need WSIF ?
    3) I can have a JX-RPC client , I can have a similar generic(reflection)code
    for built-in/primitive datatypes and for
    complex datatypes I anywayz would be doing the same thing(requiringthe java
    representation of the datatype unless I use
    something like JROM or something which I do not want to) in JAX-RPC orWSIF.
    >
    4) As far as syncronous or asyncronous invocation is concerned , myunderstanding
    is that my client call is going to remain the
    same ..the service provider is going to either use message-oriented orRPC
    on his side...
    Again assuming that I am interested only with services talking SOAP, thiscould
    be my generic client invocation design
    Background is that my client is going to run from within a WLS70sp1
    Actors:
    a) webSevice1ClientSessionBean : This will be a stateless session beanwhich might
    have knowledge about webSevice1's end-point ,
    complex dataTypes if any.
    (There would be other session beans like this which would haveknowledge about
    other specific webservice)
    b) GenericWebServiceInvoker : This will have knowledge about everythingwithin
    the webservice-standards/protocols.
    eg:
    //set weblogic ServiceFactory
    System.setProperty( "javax.xml.rpc.ServiceFactory",
    "weblogic.webservice.core.rpc.ServiceFactoryImpl" );
    //create service factory
    ServiceFactory factory = ServiceFactory.newInstance();
    //define qnames
    String targetNamespace = "http://soapinterop.org/";
    QName serviceName = new QName( targetNamespace, "SimpleTest" );
    QName portName = new QName( targetNamespace, "SimpleTestSoap" );
    QName operationName = new QName( "http://soapinterop.org/",
    "echoStruct" );
    //create service
    Service service = factory.createService( serviceName );
    TypeMappingRegistry registry = service.getTypeMappingRegistry();
    TypeMapping mapping = registry.getTypeMapping(
    SOAPConstants.URI_NS_SOAP_ENCODING );
    mapping.register( SOAPElement.class,
    new QName( "http://soapinterop.org/xsd", "SOAPStruct" ),
    new SOAPElementCodec(),
    new SOAPElementCodec() );
    //create call
    Call call = service.createCall();
    //set port and operation name
    call.setPortTypeName( portName );
    call.setOperationName( operationName );
    call.addParameter( "inputStruct",
    new QName( "http://soapinterop.org/xsd", "SOAPStruct" ),
    ParameterMode.IN);
    All parameter values specific to a particular webservice likeQName,targetNameSpace
    etc will be sent to this invoker by
    webSevice1ClientSessionBean. The GenericWebServiceInvoker will invokethe
    service
    (using reflection for primitive/builtin types) and alwayz accept anobject
    from the service operation and just return
    that "object" back the webSevice1ClientSessionBean.ThewebSevice1ClientSessionBean
    will know how to interpret the
    complexdataType or builtInDatatype whichever is returned.TheGenericWebServiceInvoker
    will not have any application
    specific knowledge...it will just have knowledge about how todiscover, invoke
    any SOAP webservice...
    Somewhere in the beginning of GenericWebServiceInvoker I will use JAXRto
    discover services from UDDI if needed.
    This way I will have a generic webservice client invocation frameworkwhich
    can invoke any service which talks SOAP.
    Now lemme know how the above picture looks and what is missing...
    I have some questions :
    1) Incase of complex dataTypes, I will have itz XML representation inthe
    publisher's WSDL and the publisher will give
    me the java representation of the complex dataType.But how does myclient
    JAX-RPC know how to map the XML
    to the java representation unless I specify the mapping somewhere?Does
    the TypeMapping/TypeMappingRegistry do this ?
    Thanx,
    Krish
    "Michael Wooten" <[email protected]> wrote:
    You know, it's really cool to hear guys thinking things through, before
    they "jump
    on a bandwagon" :-)
    Anyway, I suspect that the performance overhead of doing reflection,
    and heavy
    server-side code intrusion, is what has made a lot of developers balk
    at using
    WSIF. I would check out the IBM newsgroups, to see what the general
    developer
    sentiment is on WSIF.
    To achieve any sort of decent performance with JAX-RPC based webservices,
    you
    need to do a fair amount of optimization/tuning on both the client and
    server
    side. I recommend setting up your own "lab environment" for doing these,
    so you
    can see exactly what's making things improve/degrade. If you are really
    interested
    in this topic, we should talk about it "off-line".
    In general, the more "dynamic" things are on the client side, the slower
    things
    will be, the more you really need to question if you really need them
    to be dynamic
    :-) Does making it "dynamic" really offer something that you can't get
    from a
    "static" version? If not, who's really benefiting here. I mean, com'n.
    All you
    really want to do is invoke an operation, right? By the time you get
    all the information
    it takes to do a dynamic invocation (i.e. port, target namespace, data
    type for
    input argument, serializer/deserializer for each non-built-in data type,
    etc.),
    your client looks like you are trying to boot a PDP-11! LOL! For those
    of you
    who don't know what a PDP-11 is, it's an early computer (from the'60-'70),
    that
    you actually had to use switches to create the "binary instructions"
    to boot it
    up!
    From a PM's (product manager's) perpective, I wouldn't even let thedevelopers
    modify "working" EJBs to expose them as a web service. Alarm bells should
    go off
    in your head, if you have to modify existing server-side code to expose
    a company
    asset as a web service.
    Response to OT comment: WebLogic Server 7.0 uses its own implementation
    of JAX-RPC
    1.0. This implementation, I've been told by one of the BEA engineering
    that worked
    on it, has been certified to be JAX-RPC compliant by Sun. Don't know
    about Apache
    Axis, in this regard. I use both Apache Axis and the JWSDP with WLS 6.1,
    but I
    haven't really spent a lot of time looking for differences between our
    (BEA's)
    implementation, and theirs.
    Regards,
    Mike Wooten
    "Krish Venkataraman" <[email protected]> wrote:
    Hey Mike ...
    I hear ya..and I see the significance of WSIF...but that IBM started
    it a year
    back and itz not yet stabilized is what is holding me back...
    U mite have a better hold of what WSIF can do...whatever I could grasp
    from yesterday
    is this...
    a)It reads meta data from the wsdl and using a reflection mechanismcalls
    the
    service operations...
    I see examples with primitive datatypes..but what happens when
    complex/custom
    datatypes come into play...
    Would the client code differ between synchronous invocation toasynchronous
    invocation...
    And aleast in the samples for the WSIF distribution for connectors like
    EJB/JMS
    etc, the code does not look generic anymore..there are specific calls
    to operations
    and parameters...
    Also Mike , what is the trade-off on performance between having adynamic
    client(lets
    say based on WSIF)or having a static client...the extent of reflection
    a dynamic
    client will have to do and create SAAJ objects at runtime will beenormous..
    Also I know that there is a relevant API...but can u give an examleshowing
    me
    how I could discover services from UDDI ..?
    Out of this current topic...does BEA use itz own implementation of SOAP
    in itz
    webservice implementation...and how does it compare with AXIS ?
    Thanx,
    Krish
    "Michael Wooten" <[email protected]> wrote:
    Hi Krish,
    Well, I guess that's how things are when "needed functionality exceeds
    the current
    state of a technology" :-)
    I (not necessarily BEA) look at it like way:
    1. IBM co-authored the "Big 3" XML grammars for the current web
    services
    stack.
    2. IBM always appears to be "there, somewhere" in the new crop ofproposed
    additional
    XML grammars for "partially agreed upon extension layers", for theweb
    services
    stack.
    3. IBM donated it's original SOAP implementation to the open-sourcecommunity.
    4. IBM came up with WSIF over a year ago.
    5. IBM's WSTK uses the Apache Axis stuff.
    6. A lot of the JAX-RPC/JAXM API is based on the Apache SOAP and Apache
    Axis implementations.
    7. It looks like IBM may have donated WSIF to Axis.
    8. You appear to need something like WSIF :-)
    So, there's probably at least a 60/40 chance that some WSIF-like thing
    will make
    it into the JWSDP, right? If you want "higher odds", you should talk
    to the folks
    working on the JWSDP, as they are somewhat "in charge" here :-)
    Regards,
    Mike Wooten
    "Krish Venkataraman" <[email protected]> wrote:
    Yes...I am surely lookin at something similar...but that framework
    not
    being standardized
    scares me as I have seen many good ideas not seeing the light of the
    day...and
    I do not want to design something using a framework which might remain
    un-standardized..
    what are ur thots..
    Thanx,
    Krish
    "Michael Wooten" <[email protected]> wrote:
    Hi Krish,
    It sounds like you want WSIF :-)
    "WSIF allows stubless or completely dynamic invocation of a Web
    service,
    >>>>>>
    based upon examination of the meta-data about the service at runtime.
    It
    also allows updated implementations of a binding to be plugged intoWSIF
    at
    runtime, and it allows the calling service to defer choosing a
    binding
    until
    runtime."
    Correct?
    This is a relatively new "unofficial" addition to the Web ServicesStack,
    so it
    is not in WLS 7.0 (or Sun's JWSDP) yet. See the following link formore
    details:
    http://xml.apache.org/axis/wsif
    Regards,
    Mike Wooten
    "Krish Venkataraman" <[email protected]> wrote:
    Hey ,
    I have an application which requires to talk to 2 different
    published
    webservices
    from 2 different systems. Now instead od designing static webservice
    clients for
    each of these systems(which would involve having separate proxyjars
    etc),
    I am planning to design a dynamic webservice locator and invoker....
    I know that we can have webservice clients which are dynamic tothe
    extent
    that
    we can create proxy objects at runtime once we know the endpoint
    WSDL..
    eg:
    ServiceFactory factory = ServiceFactory.newInstance();
    QName serviceName =new QName
    targetNamespace,"net.xmethods.services.stockquote.StockQuoteService");
    >>>>>>>
    QName portName = newQName(targetNamespace,"net.xmethods.services.stockquote.StockQuotePort");
    >>>>>>>
    QName operationName = newQName("urn:xmethods-delayed-quotes","getQuote");
    >>>>>>>
    URL wsdlLocation = newURL("http://services.xmethods.net/soap/urn:xmethods-delayed-quotes.wsdl");
    >>>>>>>
    // create service
    Service service = factory.createService(wsdlLocation, serviceName);
    // create call Call call = service.createCall(portName,
    operationName);
    >>>>>>>
    >>>>>>>
    My question on this...if I have a dynamic approach like the abovewhat
    are the
    pros and cons..I guess it would surely have more overhead comparedto
    a static
    client...?
    Secondly ,is it even feasible to design a dynamic client in such
    a
    way
    that the
    endpoint WSDL could also be an unknown and my generic client wouldalso
    locate
    the end-point dynamically and then invoke dynamic calls as above...
    If anybody can share their insights on a dynamic webservice client
    I would really
    appreciate it...
    Thanx,
    Krish
    KRISH.VENKATARAMAN
    Senior Technology Analyst
    Bank of America Corp.
    Email:[email protected]
    [BrowserClient.java]
    [DynamicClient.java]

  • Dynamic proxy on jwsdp 1.1 deserialization error

    Hi,
    I want to use a dynamic proxy to get information from an webservice.
    normal datatypes like String or integer works fine. But when I want to have an object back, I get an deserialization error. I use sdk 1.3.1_08 and the jwsdp 1.1
    Does the jwsdp 1.1 support to transfer objects with dynamic proxy?
    thx
    Matthias

    I must use the jwsdp 1.1 because our clients run on IBM-Webspehre the highest sdk wich is at the moment supported is sdk 1.3.1_08.
    But with the jwsdp and sdk 1.4.2 I became also an exception.
    her it is:
    UrlString = http://localhost:8080/uisservice/endpoint?WSDL
    deserialization error: java.lang.NullPointerException
         at com.sun.xml.rpc.encoding.ObjectSerializerBase.deserialize(ObjectSerializerBase.java:212)
         at com.sun.xml.rpc.encoding.ReferenceableSerializerImpl.deserialize(ReferenceableSerializerImpl.java:115)
         at com.sun.xml.rpc.client.dii.CallInvokerImpl._readFirstBodyElement(CallInvokerImpl.java:188)
         at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:168)
         at com.sun.xml.rpc.client.dii.CallInvokerImpl.doInvoke(CallInvokerImpl.java:56)
         at com.sun.xml.rpc.client.dii.BasicCall.invoke(BasicCall.java:281)
         at com.sun.xml.rpc.client.dii.CallInvocationHandler.doCall(CallInvocationHandler.java:98)
         at com.sun.xml.rpc.client.dii.CallInvocationHandler.invoke(CallInvocationHandler.java:70)
         at $Proxy0.getTestUser(Unknown Source)
         at test.TestClient.main(TestClient.java:37)
    CAUSE:
    java.lang.NullPointerException
         at com.sun.xml.rpc.encoding.soap.SOAPResponseSerializer.doDeserialize(SOAPResponseSerializer.java:106)
         at com.sun.xml.rpc.encoding.ObjectSerializerBase.deserialize(ObjectSerializerBase.java:165)
         at com.sun.xml.rpc.encoding.ReferenceableSerializerImpl.deserialize(ReferenceableSerializerImpl.java:115)
         at com.sun.xml.rpc.client.dii.CallInvokerImpl._readFirstBodyElement(CallInvokerImpl.java:188)
         at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:168)
         at com.sun.xml.rpc.client.dii.CallInvokerImpl.doInvoke(CallInvokerImpl.java:56)
         at com.sun.xml.rpc.client.dii.BasicCall.invoke(BasicCall.java:281)
         at com.sun.xml.rpc.client.dii.CallInvocationHandler.doCall(CallInvocationHandler.java:98)
         at com.sun.xml.rpc.client.dii.CallInvocationHandler.invoke(CallInvocationHandler.java:70)
         at $Proxy0.getTestUser(Unknown Source)
         at test.TestClient.main(TestClient.java:37)
    CAUSE:
    java.lang.NullPointerException
         at com.sun.xml.rpc.encoding.soap.SOAPResponseSerializer.doDeserialize(SOAPResponseSerializer.java:106)
         at com.sun.xml.rpc.encoding.ObjectSerializerBase.deserialize(ObjectSerializerBase.java:165)
         at com.sun.xml.rpc.encoding.ReferenceableSerializerImpl.deserialize(ReferenceableSerializerImpl.java:115)
         at com.sun.xml.rpc.client.dii.CallInvokerImpl._readFirstBodyElement(CallInvokerImpl.java:188)
         at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:168)
         at com.sun.xml.rpc.client.dii.CallInvokerImpl.doInvoke(CallInvokerImpl.java:56)
         at com.sun.xml.rpc.client.dii.BasicCall.invoke(BasicCall.java:281)
         at com.sun.xml.rpc.client.dii.CallInvocationHandler.doCall(CallInvocationHandler.java:98)
         at com.sun.xml.rpc.client.dii.CallInvocationHandler.invoke(CallInvocationHandler.java:70)
         at $Proxy0.getTestUser(Unknown Source)
         at test.TestClient.main(TestClient.java:37)
    and here my client class:
    public class TestClient {
         public static void main(String[] args) {
              try {
                   String UrlString ="http://localhost:8080/uisservice/endpoint?WSDL";
                   String nameSpaceUri = "http://localhost:8080/uisservice/wsdl/UisService";
                   String serviceName = "UisService";
                   String portName = "UisServicePort";
                   System.out.println("UrlString = " + UrlString);
                   URL helloWsdlUrl = new URL(UrlString);
                   ServiceFactory serviceFactory = ServiceFactory.newInstance();
                   Service uisService = serviceFactory.createService(helloWsdlUrl,
                        new QName(nameSpaceUri, serviceName));
                   //END E anderer code
                   UisService
                        myProxy = (UisService)uisService.getPort(new QName(nameSpaceUri, portName), UisService.class);
              System.out.println(myProxy.getTestUser().getFirstname());
              } catch (Exception ex) {
                   ex.printStackTrace();

Maybe you are looking for

  • Built-in microphone not working

    I can't get my Imac's microphone to work, all that is heard is static and doesn't seem to pick up any sound at all. Anyone know how to solve this?

  • BAPI_SHIPMENT_CREATE - Shipment without outbound deliveries

    Hello experts, I am implementing bapi BAPI_SHIPMENT_CREATE for generating shipment number (VT01N). The user inputs are (1) outbound delivery number (2) shipment type and (3) forwarding agent. BAPI is generating shipment number in simulation and when

  • Need infor on PO Header text table

    Hi. List the table name in which Purchase order Header text will stored. Cheers Umakanth

  • Organizer 8 will not launch after installing Windows 8

    I have PSE 8,0 and it was running just fine. Now I have installed Windows 8 and I can't open the organizer? Is there an explanation of this? Message title was edited by: Brett N

  • What is the current directory when running Tomcat

    Hi, In one of my classes I try to open a file for reading. I did this with: FileReader fr = new FileReader("files/httpd.conf"); When I try to run the project, it can't find the file. I tried every possible place in my webapps directory and when I ins