Invoking a web service from dynamic client in weblogic 7

Is it possible to invoke a webservice from dynamic client in weblogic 7. Because i tried and it doesn't work. But it works with WL 8.1
I don't see any samples on the net for weblogic 7.

Hello rss,
If you want to invoke a web service from a JCD you will have to build the SOAP message using JAX-RPC or AXIS and then programmatically creat an HTTP connection.
Or you can leverage the HTTP(S) eWay and then you only have to build the SOAP message.
Or use eInsight. You can import a WSDL into eInsight and eInsight will offer you a business process Activity to invoke the web service operations defined in the WSDL.

Similar Messages

  • Getting .ServiceException while invoking a web service from a client

    I created a web service and then created a web service client from wsdl in eclipse. I am getting the following error when trying to call the web service from client.
    javax.xml.rpc.ServiceException: There is no stub implementation for the interface: examples.ejb.ejb20.basic.statelessSession.TraderBeanService
    Please find the files here -
    wsdl - http://www.sourcepod.com/uneksu63-9627
    Trade.java - http://www.sourcepod.com/mltizr21-9628
    TradeResult.java - http://www.sourcepod.com/npledh19-9629
    TradeResultService - http://www.sourcepod.com/hbjevm45-9630
    TradeResultServiceLocator.java - http://www.sourcepod.com/mrpagh85-9631
    TradeResultSoapBindingStub.java - http://www.sourcepod.com/zjrkjv91-9632
    package examples.ejb.ejb20.basic.statelessSession;
    import javax.xml.ws.WebServiceRef;
    import javax.xml.namespace.QName;
    public class HelloClient {
        @WebServiceRef(wsdlLocation="http://localhost:7001/webservice/services/TraderBean?wsdl")
        String url = "http://localhost:7001/webservice/services/TraderBean?wsdl";
             QName qname = new QName("http://statelessSession.basic.ejb20.ejb.examples", "TraderBeanService");
        public static void main(String[] args) {
            try {
                HelloClient client = new HelloClient();
                client.doTest(args);
            } catch(Exception e) {
                e.printStackTrace();
        public void doTest(String[] args) {
            try {
                 TraderBeanServiceLocator service = new TraderBeanServiceLocator(url,qname);
                TraderBean port = (TraderBean) service.getPort(TraderBeanService.class);
                System.out.println("Invoking the sayHello operation on the port.");
                TradeResult response = port.buy("INR", 100);
                System.out.println(response.getNumberTraded());
            } catch(Exception e) {
                e.printStackTrace();
    }How to solve the stub implementation error?
    Edited by: 901007 on 12 Aug, 2012 10:57 AM

    That did not work either. There was getPorts() and not getPort() and I used getPorts(). And I am getting the below error,
    java.lang.ClassCastException: java.util.HashMap$KeyIterator
    But when I try like the below,
        @WebServiceRef(wsdlLocation="http://localhost:7001/webservice/services/TraderBean?wsdl")
        String url = "http://localhost:7001/webservice/services/TraderBean?wsdl";
        QName qname = new QName("http://statelessSession.basic.ejb20.ejb.examples", "TraderBeanService");
                TraderBeanServiceLocator service = new TraderBeanServiceLocator();
                TraderBean port = (TraderBean) service.getPort(TraderBean.class);
                System.out.println("Invoking the sayHello operation on the port.");
                TradeResult response = port.buy("INR", 200);
                System.out.println(response.getNumberTraded());I am getting the below error,
    Invoking the sayHello operation on the port.
    AxisFault
    faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
    faultSubcode:
    faultString: java.lang.InstantiationException: examples.ejb.ejb20.basic.statelessSession.TraderBean
    faultActor:
    faultNode:
    faultDetail:
         {http://xml.apache.org/axis/}hostname:Gopi_Desktop
    java.lang.InstantiationException: examples.ejb.ejb20.basic.statelessSession.TraderBean
    As you can see the statement"Invoking the sayHello operation on the port." is getting printed but after that error is thrown.
    I tried changing it to, TraderBean port = (TraderBean) service.getPort(qname, TraderBeanServiceLocator.class);
    But even this is throwing the same error, java.lang.InstantiationException: examples.ejb.ejb20.basic.statelessSession.TraderBean
    I changed my webservice using Axis2 web service runtime and this time when I try to invoke using client, I am getting the following,
    [WARN] Weblogic's StAX implementation is unsupported and some Axiom features will not work as expected! Please use Woodstox instead.
    Exception in thread "Main Thread" org.apache.axis2.AxisFault: javax.xml.stream.XMLStreamException: Error at line:1 col:217 ':' Already got a ':' in name
         at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:531)
         at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:375)
         at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:421)
         at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
         at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
         at examples.ejb.ejb20.basic.statelessSession.TraderBeanStub.addTwoNumbers(TraderBeanStub.java:185)
         at examples.ejb.ejb20.basic.statelessSession.TestClient.main(TestClient.java:15)
    If you need more details, I can post the steps I did to build it...
    Any help is greately appreciated.
    Edited by: 901007 on 15 Aug, 2012 10:27 PM
    Edited by: 901007 on 15 Aug, 2012 10:49 PM

  • Issues in invoking a web service from a JAVA/BPEL client...

    We are trying to invoke a web service from a JAVA/BPEL client using org.apache.soap classes. But everytime we are running into issues of IllegalAccessError or InvalidClassError or IncompatibleClassError based on different jars we are trying to include in our project. Attached is a simple BPEL project which tries to invoke a web service through JAVA embedding (no supporting jars need to be included explicitly). It erros with following trace:
    Class org/apache/soap/Envelope violates loader constraints
         Invalid class: org.apache.soap.Envelope
         Loader: soap:10.1.3
         Code-Source: /slot/ems1508/oracle/product/10.1.3.1/OracleAS_1/webservices/lib/soap.jar
         Configuration: <code-source> (ignore manifest Class-Path) in META-INF/boot.xml in /slot/ems1508/oracle/product/10.1.3.1/OracleAS_1/j2ee/home/oc4j.jar
         Dependent class: org.apache.soap.rpc.RPCMessage
         Loader: soap:10.1.3
         Code-Source: /slot/ems1508/oracle/product/10.1.3.1/OracleAS_1/webservices/lib/soap.jar
         Configuration: <code-source> (ignore manifest Class-Path) in META-INF/boot.xml in /slot/ems1508/oracle/product/10.1.3.1/OracleAS_1/j2ee/home/oc4j.jar
    Could you please help us out or provide any pointers. Any help would be highly appreciated

    Because you weren't told what to get, perhaps you already have it eh?
    What you want to read up about is JAX-WS, which is the webservice API bundled by default with your JDK (Java 6 and up). You'll find the wsimport tool in the bin directory of your JDK. I recommend you explore that directory and read up about all the executables you can find there, to be more prepared in the future. Know the tools you work with and all that. Most tools have a manual on this website:
    http://www.oracle.com/technetwork/java/javase/tech/index.html
    (under tools and utilities). Not wsimport, that is part of the jax-ws documentation. Better you look for jax-ws tutorials using Google, it will be quicker.

  • Invoking one web service from another web service

    Hi there,
    I want to invoke a web service lets say X. But befor sending parameters to this web service, what i want to do is first pass the parameters to a web service called Y and Y will decide wether to call X or not. In other words i want to invoke a web service from another web service.
    Its kind of urget so do the needful asap.
    Thanks

    Calling another webservice from within a webservice does not require anything special. The service (say svc1) that calls another service (svc2) will be a web svc client. So you will have to do the same steps for svc1 as you would do for any other web service client

  • Invoking a Web Service from a mobile application

    Hi all,
    I have installed Sun Wireless Toolkit 2.5.2 for CDLC and MTJ.
    I want to invoke a web service from an MTJ Application and I have not a clue of how to start.
    First let me say I am working with RSA (which is over Eclipse)
    My first attempt was creating the web service client and then try to convert it into a mobile application (through the use of MTJ --> Convert to Midlet Project)
    I found 4 errors when doing so:
    First was solved changing the jre to 1.6.
    I am still dealing with the following three:
    * Error preverifying class mipaquete.MiServicioService
    java/lang/NoClassDefFoundError: javax/xml/ws/Service
    * Error preverifying class mipaquete.ObjectFactory
    VERIFIER ERROR mipaquete/ObjectFactory.createMiOperacion(Lmipaquete/MiOperacion;)Ljavax/xml/bind/JAXBElement;:
    Illegal type in constant pool
    * Type mipaquete.MiServicioPortProxy$Descriptor Error preverifying class mipaquete.MiServicioPortProxy$Descriptor
    VERIFIER ERROR mipaquete/MiServicioPortProxy$Descriptor.getDispatch()Ljavax/xml/ws/Dispatch;:
    Illegal type in constant pool
    I only started to solve the first one. I assumed that I have to add the right .jar to manifest file (please let me know if I am wrong). I tried to do by adding the textual classpath rt.jar, however I am not able to give it the right path:
    C:\Archivos de programa\IBM\SDP\runtimes\base_v7_stub\java\jre\lib\rt.jar (even though I split the too long sentence into two and I include an space at the beginning of the second, I still get an error when saving)
    I would appreciate any help
    A) to solve the existing problems
    or
    B) To create a web service client in an EclipseME application through any other method.
    Thank-you very much in advance,
    Guadalupe
    PS Any clue is welcomed!!

    Hello rss,
    If you want to invoke a web service from a JCD you will have to build the SOAP message using JAX-RPC or AXIS and then programmatically creat an HTTP connection.
    Or you can leverage the HTTP(S) eWay and then you only have to build the SOAP message.
    Or use eInsight. You can import a WSDL into eInsight and eInsight will offer you a business process Activity to invoke the web service operations defined in the WSDL.

  • Problem invoking a web service from soa11g BPEL.

    Hi ,
    I am trying to invoke a web service from soa bpel 11g composite.
    We have the wsdl, wsdl URL of the web service along with the user name , password credentials.
    Initially w/o any WS policy attached and testing the composite, it fails with the below message
    *<fault>*
    *<bpelFault>*
    *<faultType>0</faultType>*
    *<remoteFault>*
    *<part name="summary">*
    *<summary>An Authentication object was not found in the SecurityContext</summary>*
    *</part>*
    *<part name="detail">*
    *<detail>javax.xml.ws.soap.SOAPFaultException: An Authentication object was not found in the SecurityContext</detail>*
    *</part>*
    *<part name="code">*
    *<code>soap:Server</code>*
    *</part>*
    *</remoteFault>*
    *</bpelFault>*
    *</fault>*
    *<faultType>*
    *<message>0</message>*
    *</faultType>*
    *</messages>*
    So I have gone back to the composite and added the WS policy (oracle/wss_username_token_client_policy) by Right clicking on web service -> Configure WS Policy -> Security -> oracle/wss_username_token_client_policy -> OK.
    After this I have added the following binding properties 'oracle.webservices.auth.username' , 'oracle.webservices.auth.password' with the respective values and deployed it again.
    Even then I face the same issue. I have looked into the EM console and found the HTTP username and password properties were blank for this Web service even though the WS policy was attached.
    Later I have tried editing the username pwd from the EM console, only to find out that the composite was now failing in the previous step (an ordinary db adapter with a select statement) even before it reaches the web service invocation.
    If I redeploy the composite, the http username and pwd properties in the EM console are erased and when i test it, it errors out at the web service invocation with the same issue again.
    Any pointers on how to solve this issue ??
    How can I figure out what is the security policy the web service is using ??
    Regards,
    Shiva Kiran

    Hi,
    Can anyone help me with this ??
    I guess I am not able to send the authorization credentials via the request to the web service invocation.
    Plz help ! This is a bit urgent..
    Regards,
    Shiva Kiran

  • Invoking a web service from jcd

    hi all,
    Is there any built-in class in CAPS5.1 for invoking a web servervice from jcd directly. Or is there any some other automation/mechanism to achieve the same, plz provide me any sample code avilable for the same.its very urgent for me.
    Thanks

    Hello rss,
    If you want to invoke a web service from a JCD you will have to build the SOAP message using JAX-RPC or AXIS and then programmatically creat an HTTP connection.
    Or you can leverage the HTTP(S) eWay and then you only have to build the SOAP message.
    Or use eInsight. You can import a WSDL into eInsight and eInsight will offer you a business process Activity to invoke the web service operations defined in the WSDL.

  • Invoking Asynchronous Web Service from BPEL Process

    Hi,
    I have been working on the BPEL Process Manager for some time and now facing problem in invoking asynchronous web service from a BPEL Process. I have implemented a web service in Java using Axis but wasn't able to invoke it.
    I have gone through all the meterial available on this site but couldn't get any great help.
    Can some one help me in resolving this issue. A pointer to any example or sample material/tutorial will be appreciated.
    thanks
    Farooq

    I do the same thing.
    Take wsdl from axis and save it somewhere.
    Then you can create a standard project in Oracle BPEL PM. Create partnerlink, give a name and click on first icon to take your wsdl. It will add some needed code, you answer always yes. Then you can create receive, assign, invoke, assign and callback or similar and deploy it.
    Try it through BPEL Console...
    Ema

  • How to invoke a Web Service from PL/SQL with Complex Type as  input.

    Hello,
    I am trying to invoke a web service from PL/SQL using the UTL_DBWS package.
    The web service expects a complex type as input (defined below):
    <xs:complexType name="MsgType">
    <xs:sequence>
    <xs:element name="sender" type="xs:string"/>
    <xs:element name="messageId" type="xs:string"/>
    <xs:element name="messageType" type="xs:string"/>
    <xs:element name="dateSent" type="xs:date"/>
    </xs:sequence>
    </xs:complexType>
    How to construct input to this in PL/SQL Procedure?
    Has any body tried this before?
    An exmaple will be helpful.
    Thanks

    Dear,
    I have read your article, it is useful for me. But I cannot Apply to my case. Please kindly help me. Thank you.
    When running, the error occurs:
    1:39:31 Execution failed: ORA-20000: soapenv:Server.userException - org.xml.sax.SAXParseException: Attribute name &quot;password&quot; associated with an element type &quot;user&quot; must be followed by the &apos; = &apos; character.
    My webservice Url: http://abc.com.vn:81/axis/ABC_WS_TEST.jws?wsdl
    I make PL/SQL (similiar as your example)
    FUNCTION INVOKESENDMT
    RETURN VARCHAR2
    AS
    l_request soap_api.t_request;
    l_response soap_api.t_response;
    l_return VARCHAR2(32767);
    l_url VARCHAR2(32767);
    l_namespace VARCHAR2(32767);
    l_method VARCHAR2(32767);
    l_soap_action VARCHAR2(32767);
    l_result_name VARCHAR2(32767);
    p_zipcode VARCHAR2(160);
    BEGIN
    --p_zipcode:='''TEST'' ; ''TEST'';''84912187098'';''84912187098'';''0'';''8118'';''1'';''000001'';''ThuNghiem'';''''';
    p_zipcode:='TEST';
    -- Set proxy details if no direct net connection.
    --UTL_HTTP.set_proxy('myproxy:4480', NULL);
    --UTL_HTTP.set_persistent_conn_support(TRUE);
    -- Set proxy authentication if necessary.
    --soap_api.set_proxy_authentication(p_username => 'TEST',
    -- p_password => 'TEST');
    l_url := 'http://abc.com.vn:81/axis/ABC_WS_TEST.jws';
    l_namespace := 'xmlns="' || l_url || '"';
    l_method := 'sendMT';
    l_soap_action := l_url || '#sendMT';
    l_result_name := 'sendMTResponse';
    l_request := soap_api.new_request(p_method => l_method,
    p_namespace => l_namespace);
    soap_api.add_parameter(p_request => l_request,
    p_name => 'user password sender receiver chargedflag servicenumber messagetype messageid textcontent binarycontent',
    p_type => 'xsd:string',
    p_value => p_zipcode);
    l_response := soap_api.invoke(p_request => l_request,
    p_url => l_url,
    p_action => l_soap_action);
    l_return := soap_api.get_return_value(p_response => l_response,
    p_name => l_result_name,
    p_namespace => l_namespace);
    RETURN l_return;
    END;

  • Invoking Imaging Web Service from BPEL is failing

    Hi,
    My Env is on latest 11g 11.1.1.8.
    I am trying to invoke the Imaging Web Services (http://host:port/imaging/ws/ApplicationService?wsdl)deployed in another Weblogic Server from Bpel. When I tried to invoke this web service with out security credentials it was failing due to access issue.
    I tried invoking  the imaging web service by following below steps.
    Added oracle/wss_http_token_client_policy for Imaging Web service Reference.
    Added these properties in Composite for the reference binding as below.
    <wsp:PolicyReference URI="oracle/wss_http_token_client_policy"
                               orawsp:category="security" orawsp:status="enabled"/>
          <property name="weblogic.wsee.wsat.transaction.flowOption"
                    type="xs:string" many="false">SUPPORTS</property>
          <property name="weblogic.wsee.wsat.transaction.version" type="xs:string"
                    many="false">DEFAULT</property>
         <property name="oracle.webservices.auth.username" type="xs:string"
                    many="false" override="may">weblogicxz</property>
          <property name="oracle.webservices.auth.password" type="xs:string"
                    many="false" override="may">welcome111</property>
          <property name="httpBasicUsername">weblogicxz</property>
          <property name="httpBasicPassword">welcome111</property>
    But now While testing my Bpel Flow my reference is failing with below erro. Can you please help me resolving this issue. 
    <messages>
    <input>
    <Invoke1_getApplication_InputVariable>
    <part  name="parameters">
    <getApplication>
    <appNameId>
    <id>2</id>
    <name>CaptureImageApplication</name>
    </appNameId>
    <sectionFlags/>
    </getApplication>
    </part>
    </Invoke1_getApplication_InputVariable>
    </input>
    <fault>
    <bpelFault>
    <faultType>0</faultType>
    <remoteFault>
    <part  name="summary">
    <summary>MustUnderstand headers:[{http://schemas.xmlsoap.org/ws/2004/10/wscoor}CoordinationContext] are not understood</summary>  
    </part>
    <part  name="detail">
    <detail>oracle.j2ee.ws.client.jaxws.JRFSOAPFaultException: Client received SOAP Fault from server : MustUnderstand headers:[{http://schemas.xmlsoap.org/ws/2004/10/wscoor}CoordinationContext] are not understood</detail>  
    </part>
    <part  name="code">
    <code>{http://schemas.xmlsoap.org/soap/envelope/}MustUnderstand</code>  
    </part>
    </remoteFault>
    </bpelFault>

    Hi,
    I don't think it is failing due to access issue, I think it is failing because one of the parts is NOT configured to use WS-AT (WS-Atomic Transactions)...
    MustUnderstand headers:[{http://schemas.xmlsoap.org/ws/2004/10/wscoor}CoordinationContext] are not understood
    Why did you add this?
          <property name="weblogic.wsee.wsat.transaction.flowOption"
                    type="xs:string" many="false">SUPPORTS</property>
          <property name="weblogic.wsee.wsat.transaction.version" type="xs:string"
                    many="false">DEFAULT</property>
    Cheers,
    Vlad

  • Invoking a web service through a client

    According to examples on e-docs.bea.com , a client is invoking a web service by writing a build.xml for itself and then deploying his code.It seems funny that a client is first deploying his code through ant to generate stubs and then invoking the web service.please let me know if there is any other way to call a web service??

    using the file adaptor i am able to read files from the local file system...
    my problem is i am uploading files thru multipart request...now i have this file availaible to me in the servlet which is processing the multipart request and calling the axis web service client...
    how do i pass this file thru the file adaptor to the payload...?

  • Invoking a Web Service from EJB

    Hi
    I need to invoke a web serice from existing EJB(stateless session bean) deployed
    in J2EE SDK 1.3.1.
    I have downloaded Java WSDP but I have no idea where to start.
    Can any one briefly explain to me how to do this ?
    Thanks.

    Hello,
    look in the tutorial from the JWSDP under 'Java API for XML-based RPC' there is a section 'JAX-RPC on the J2EE SDK 1.3.1'. There is explained how to setup the the j2ee server for web services. It is the easiest way to learn it.
    Andr�

  • Invoking a web service from a java code

    Hello
    I created a simple Web service using JDevlper. It contains two methods
    1) getInf int () {
    return inf;}
    2) void setInf (int a) {
    inf = a;}
    I have deployed it on Oracle Application server. By inserting the address in a browser, I tried both methods and it works correctly.
    Here I am looking how to invoke this web service using a java client and use the method setInf (5 ) / * for example * /.
    I search but I have not found an answer that works :(. I hope you could help me to solve this problem.
    Thank you in advance

    Because you weren't told what to get, perhaps you already have it eh?
    What you want to read up about is JAX-WS, which is the webservice API bundled by default with your JDK (Java 6 and up). You'll find the wsimport tool in the bin directory of your JDK. I recommend you explore that directory and read up about all the executables you can find there, to be more prepared in the future. Know the tools you work with and all that. Most tools have a manual on this website:
    http://www.oracle.com/technetwork/java/javase/tech/index.html
    (under tools and utilities). Not wsimport, that is part of the jax-ws documentation. Better you look for jax-ws tutorials using Google, it will be quicker.

  • Calling .asmx Web Service from Java Client

    hi
    I have created one java client in WSAD 5.1 to invoke .asmx web service. I have used the following code for it.
    import org.apache.axis.client.Call;
    import org.apache.axis.client.Service;
    import org.apache.axis.encoding.XMLType;
    import javax.xml.namespace.QName;
    import javax.xml.rpc.NamespaceConstants;
    import javax.xml.rpc.ParameterMode;
    import java.net.URL;
    public class JavaWS3
         public static void main(String [] args)
              try
                   // Responds the same with or without the ?WSDL
                   String     strEndPoint          = "http://www.meizlik.com/Service.asmx";
                   String     strSoapAction     = "http://www.meizlik.com/BigAdd";
                   String     strSchemaURL     = "http://www.w3.org/2001/XMLSchema";
                   String     strParamName1     = "addend_1";
                   String     strParamName2     = "addend_2";
                   String     strParameterVal1= "10";
                   String     strParameterVal2= "7";
                   String     strFunctionName     = "BigAdd";
                   //Call     call   = (Call) new Service().createCall();//Works
                   //Call     call   = new Call(strSoapAction);//Works same
                   //Call     call   = new Call(strEndPoint);//Works same
                   Service  service = new Service();
                    Call call= (Call) service.createCall();
                   call.setEncodingStyle(NamespaceConstants.NSURI_SOAP_ENCODING);
                   call.setTargetEndpointAddress(new URL(strEndPoint));
                   // first parameter in QName seemingly takes ANYTHING
                   call.setOperationName(new QName("http://www.meizlik.com", strFunctionName));
                   // Set the name of the parameter and the return type
                   call.setReturnType(XMLType.XSD_STRING);
                   call.addParameter(new QName("http://www.meizlik.com",strParamName1), XMLType.XSD_STRING, ParameterMode.IN);
                   call.addParameter(new QName("http://www.meizlik.com",strParamName2), XMLType.XSD_STRING, ParameterMode.IN);
                   // Catch the result and print it
                   // Parameter count is now ONE (1).
                   // call.setUseSOAPAction(true);//Not Necessary
                   call.setSOAPActionURI(strSoapAction);//Yes Necessary
                   String     strResult = (String) call.invoke(
                        new Object[] {
                             new String(strParameterVal1),
                             new String(strParameterVal2)
                   System.out.println("Result='" + strResult + "'");
              catch (Exception e)
                   e.printStackTrace();
                   System.out.println(e.toString());
    }this code is giving me the exception as :
    java.net.ConnectException: Operation timed out: connect due to invalid addressI visited web service URL http://www.meizlik.com/Service.asmx and its working fine.
    I also tried Java Proxy method in WSAD 5.1 but it is showing me the same error.
    Where am I wrong? Can anyone plz give me solution 4 this.
    Thanks..

    Hi,
    I have even generated folowing code with SoaMoa, it is perfect. Please try SoaMoa it is a useful tool.
    The generated code of SoaMoa :
    /* Generated Testcase by SoaMoa, :ridvan at Thu Jun 04 21:53:14 CEST 2009 */
    import java.util.Map;
    import javax.xml.namespace.QName;
    import javax.xml.soap.MessageFactory;
    import javax.xml.soap.SOAPBody;
    import javax.xml.soap.SOAPConstants;
    import javax.xml.soap.SOAPElement;
    import javax.xml.soap.SOAPEnvelope;
    import javax.xml.soap.SOAPMessage;
    import javax.xml.soap.SOAPPart;
    import javax.xml.ws.Dispatch;
    import javax.xml.ws.Service;
    import javax.xml.ws.BindingProvider;
    import javax.xml.ws.soap.SOAPBinding;
    import java.util.Iterator;
    import junit.framework.TestCase;
    public class BigAddTest extends TestCase {
    public void testBigAdd() throws Exception {
    String endpointURL = "http://www.meizlik.com/Service.asmx";
    QName serviceName = new QName("http://www.meizlik.com", "Bob_Services");
    QName portName = new QName("http://www.meizlik.com", "Bob_ServicesHttpPost");
    Service service = Service.create(serviceName);
    service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING, endpointURL);
    Dispatch<SOAPMessage> dispatch = service.createDispatch(portName, SOAPMessage.class, Service.Mode.MESSAGE);
    BindingProvider bindingProvider = (BindingProvider) dispatch;
    // Optionally Configure RequestContext to send SOAPAction HTTP
    Map<String, Object> rc = bindingProvider.getRequestContext();
    rc.put(BindingProvider.SOAPACTION_USE_PROPERTY, Boolean.TRUE);
    rc.put(BindingProvider.SOAPACTION_URI_PROPERTY, "http://www.meizlik.com/BigAdd");
    MessageFactory messagefactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
    SOAPMessage request = messagefactory.createMessage();
    SOAPPart part = request.getSOAPPart();
    SOAPEnvelope env = part.getEnvelope();
    SOAPBody body = env.getBody();
    body.addNamespaceDeclaration("www", "http://www.meizlik.com");
    SOAPElement BigAdd = body.addChildElement("BigAdd", "www");
    SOAPElement addend_1 = BigAdd.addChildElement("addend_1", "www");
    addend_1.addTextNode("11");
    SOAPElement addend_2 = BigAdd.addChildElement("addend_2", "www");
    addend_2.addTextNode("11");
    request.saveChanges();
    SOAPMessage response = dispatch.invoke(request);
    SOAPBody replyBody = response.getSOAPBody();
    SOAPElement BigAddResponse = (SOAPElement) replyBody.getChildElements(new QName("http://www.meizlik.com", "BigAddResponse")).next();
    assertNotNull( "BigAddResponse is null", BigAddResponse);
    SOAPElement BigAddResult = (SOAPElement) BigAddResponse.getChildElements(new QName("http://www.meizlik.com", "BigAddResult")).next();
    assertNotNull( "BigAddResult is null", BigAddResult);
    assertEquals("BigAddResult", "0000000000000000000000000022", BigAddResult.getTextContent());
    }

  • Invoke multiple web services in single client

    hi everyone,
    Can we invoke multiple web services in a single client?.
    --web service                                                                                                                                                                           

    We can invoke..any number of services in a client.

Maybe you are looking for