Calling a Web Service in Java

Hi All,
I would like to call a webservice using a java code?
How can i go about it?
Should i directly use the SOAPEnvelope Interface and call the wsdl?
Rgds
Aditya

Google for a JAX-WS tutorial.

Similar Messages

  • Calling a Web Service from Java

    Our java guru (who is out sick....AHHHH) created all the calls that are needed to access the web service that he has running. For example the call getLongList(String user, String password) will return a list of all outstanding transactions. He made a jar file that has service has class files for PortType, Service, Service Locator and Soap Binding stub.
    How do I call this web service from java? Do I have to import it into my classpath? or just call these parameters from within my java code?

    never mind...i got it

  • Calling a Web Service from Java Webdynpro

    Hi,
    Can any one give me step by setp details on how to call a Web Service from Java Webdynpro ?
    I tried creating a model using Import Web Service Model but when I completed creating the model, I got some errors as shown below.
    Error               The method setRouteGeometryLineArray(double[][]) in the type Trip is not applicable for the arguments (double[])     ComplexType_Trip.java     WS_INVOKE/gen_wdp/packages/com/cintas/test/model/p1     line 249
    thanks
    SBK

    Hi SBK,
    I assume you may already have read the [help guide|http://help.sap.com/saphelp_nw70/helpdata/EN/81/12703e5da3e946e10000000a114084/content.htm] This gives a pretty good idea of how to do it (step by step).
    Is there a typo in the error you pasted?
    Error The method setRouteGeometryLineArray(double][) in the type Trip is not applicable for the arguments (double[]) ComplexType_Trip.java WS_INVOKE/gen_wdp/packages/com/cintas/test/model/p1 line 249
    The square brackets [] after double in the method call appear to be reversed. Is that also in the code? or just a mistake here?
    Hope this points you in the right direction.
    BRgds,
    Simon

  • Call ABAP Web Service with Java code only

    Hi all,
    First of all, I am writing script in Adobe form but am not using the one in SAP.
    I am trying to call the web service and process the result with script open (i.e. no dataconnection created), because I am trying to do that in a dialog.
    I can call a non-SAP web service without problem, but I am not able to call a simple web service with only a single string input, anyone have any example?
    Here is the SOAP for input:
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:sap-com:document:sap:rfc:functions">
       <soapenv:Header/>
       <soapenv:Body>
          <urn:Z_RFC_GET_STAFF_BANK_INFO>
             <A_STAFF_ID>0123456</A_STAFF_ID>
          </urn:Z_RFC_GET_STAFF_BANK_INFO>
       </soapenv:Body>
    </soapenv:Envelope>
    Here is my code to call:
         var cURL = "http://some-host-name:port/sap/bc/srt/wsdl/bndg_DEDB492BB032E7F1B09F001CC4FBCEC9/wsdl11/allinone/ws_policy/document?sap-client=300";
         var response = SOAP.request(
              cURL: cURL,
              oRequest: {
                   "urn:sap-com:document:sap:rfc:functions:Z_RFC_GET_STAFF_BANK_INFO": {
                        A_STAFF_ID: "0123456"
    Regards
    Bill

    Hello I have the same problem, were you able to execute the WS through the JS code now?
    I would like to call an ABAP WS using JavaScript to return complex structures that I would like to manage directly with JS.
    I tried with this code and I get the error "RaiseError: Acrobat Raise." when the request is executed:
    var WSUrl = "http://<server>:<port>/sap/bc/srt/wsdl/bndg_4D15C75529330AF1E10000000A150429/wsdl11/allinone/ws_policy/document?sap-client=500";
    var VendorNumber = xfa.form.DATA.DATAFLOW.SF_HEADER.VENDOR_NUMBER.rawValue;
    try {
    // Create request structure, read Input out of text field
    var request = {
              "urn:sap-com:document:sap:soap:functions:mc-style:ZWsTest" : {ILifnr: VendorNumber}
    SOAP.wireDump = true;
    // Call web service using SOAP object
    var response = SOAP.request ({
            cURL: WSUrl,
            oRequest: request
    //        cAction: "urn:sap-com:document:sap:soap:functions:mc-style"
    } catch (e) {
        xfa.host.messageBox(e.toString()); //pop-up "TypeError:service.CelsiusToFahrenheit is not a funciton"
    with this other code I get the error "SOAPError: CX_ST_MATCH_ELEMENT:XSLT exception.System expected element 'ILifnr'":
    try {
        var myProxy = SOAP.connect(WSUrl);
        var result = myProxy.ZWsTest( { ILifnr: VendorNumber } );
        xfa.form.DATA.DATAFLOW.SF_HEADER.E_DESCRIPTION.rawValue = result;
    // Display the response in the console:
       console.println("Result is " + result);
    } catch (e) {
        xfa.host.messageBox(e.toString()); //pop-up "TypeError:service.CelsiusToFahrenheit is not a funciton"
    in the second option, if I make the field ILifnr optional the call is succesfully performed but the parameter is not passed to the WS. So the call is working.
    Using stand-alone LiveCycle designer 8.1 and Adobe Reader 8
    Any suggestions?
    Many thanks,
    G.
    Edited by: Guillem Mateu Navalón on Jan 13, 2011 1:13 PM

  • 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());
    }

  • Call web service using Java code

    Hi all,
    Sorry if this question sounds stupid. I am new to web services.
    I am having a web service written in oracle, using soap-api. I want to call this web service in Java application, parse the result and save it in the database.
    Can anyone please guide me on this or give me some related link. I tried searching on google, tried to implement some of the solutions I got in search results, but it was not that helpful.
    Waiting for your help. Please guide me through this.
    Waiting for your replies. Thanks in advance.
    Regards,
    Kinnaree

    Hi all,
    From my java code, I tried giving
    String testStr = service.search("and formatted_address like '%Test House%'");
    This service method is defined on my SearchPortType.java file. This and the searchClient.java, as I mentioned earlier are auto generated files by myeclipse IDE. I gave WSDL URL, which generated these two files.
    This helped me invoking the service, but it gives me an exception as below:
    Exception in thread "main" org.codehaus.xfire.XFireRuntimeException: Could not invoke service.. Nested exception is org.codehaus.xfire.fault.XFireFault: Couldn't send message.
    org.codehaus.xfire.fault.XFireFault: Couldn't send message.
         at org.codehaus.xfire.fault.XFireFault.createFault(XFireFault.java:89)
         at org.codehaus.xfire.handler.OutMessageSender.invoke(OutMessageSender.java:30)
         at org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)
         at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:79)
         at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:114)
         at org.codehaus.xfire.client.Client.invoke(Client.java:336)
         at org.codehaus.xfire.client.XFireProxy.handleRequest(XFireProxy.java:77)
         at org.codehaus.xfire.client.XFireProxy.invoke(XFireProxy.java:57)
         at $Proxy8.search(Unknown Source)
         at com.imriel.client.cbre.chelsea.util.test.searchClient.main(searchClient.java:104)
    Caused by: org.codehaus.xfire.XFireException: Couldn't send message.
         at org.codehaus.xfire.transport.http.HttpChannel.sendViaClient(HttpChannel.java:145)
         at org.codehaus.xfire.transport.http.HttpChannel.send(HttpChannel.java:48)
         at org.codehaus.xfire.handler.OutMessageSender.invoke(OutMessageSender.java:26)
         ... 8 more
    Caused by: java.net.ConnectException: Connection timed out: connect
         at java.net.PlainSocketImpl.socketConnect(Native Method)
         at java.net.PlainSocketImpl.doConnect(Unknown Source)
         at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
         at java.net.PlainSocketImpl.connect(Unknown Source)
         at java.net.SocksSocketImpl.connect(Unknown Source)
         at java.net.Socket.connect(Unknown Source)
         at java.net.Socket.connect(Unknown Source)
         at java.net.Socket.<init>(Unknown Source)
         at java.net.Socket.<init>(Unknown Source)
         at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:79)
         at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:121)
         at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:706)
         at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.open(MultiThreadedHttpConnectionManager.java:1321)
         at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:386)
         at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170)
         at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396)
         at org.codehaus.xfire.transport.http.CommonsHttpMessageSender.send(CommonsHttpMessageSender.java:369)
         at org.codehaus.xfire.transport.http.HttpChannel.sendViaClient(HttpChannel.java:123)
         ... 10 more
    Any ideas, where I am wrong????
    Regards,
    Kinnaree

  • How to access .asmx Web Service using JAVA? Newbie

    Hello Experts,
    Currently, I have a project where in I have to access a ,NET web service. It is made of C#. I just want to ask how will I start the accessing process? I made this simple equation on how my project is.
    Java Project + C#.Net Web Service = Integration
    1. Do i need to create a Web Service too for the Java Project? If yes, What are the necessary tools needed for the creation of this Java Web Service?
    2. The .NET Web Service is available online. (It is made by other people).
    3. Based on the equation, what is the equivalent technology for the + sign?
    4. Can you site a concrete example for accessing a web service?
    5. I'm new here. Totally I have no idea where to start.
    6. Thank you experts.
    Edited by: Benedict.Aluan on 05 30, 08 1:38 PM
    Edited by: Benedict.Aluan on 05 30, 08 1:39 PM

    Hello
    Thanks a lot for your help ...
    I am developing simple J2EE based web service client using IBM WSAD 5.1. I have used the following code to call .asmx web service in Java
    String url = "http://www.w3schools.com/webservices/tempconvert.asmx?wsdl";
         String namespace = "http://tempuri.org/";
         name = request.getParameter("txtName");
         try
              System.out.println("In Internet Service");
              ServiceFactory factory = ServiceFactory.newInstance();
              Service serv = factory.createService(new URL(url),new QName(namespace,"TempConvert"));
              System.out.println("Got Service......");
              Call obj = (Call)serv.createCall();
              System.out.println("Got Call......");
              obj.setProperty(Call.ENCODINGSTYLE_URI_PROPERTY,"");
              obj.setProperty(Call.OPERATION_STYLE_PROPERTY,"wrapped");
              obj.setTargetEndpointAddress(url);
              obj.setPortTypeName(new QName(namespace,"TempConvertSoap"));
              obj.setOperationName(new QName(namespace,"FahrenheitToCelsius"));
              obj.addParameter("param1",XMLType.XSD_STRING,String.class,ParameterMode.IN);
              obj.setReturnType(XMLType.XSD_STRING);
              System.out.println("Parameters Set.....");
              Object[] params = new Object[]{name};
              k = (String)obj.invoke(params);
              System.out.println("Result: "+k);
         catch(Exception e)
            System.out.println("Exception is : "+e);
        }But this code is throwing exception that
    Invalid Address "http://www.w3schools.com/webservices/tempconvert.asmx?wsdl"I have also tried this URL with Java Proxy. But it showing the same error.
    Plz can u tell me how to access .asmx web service ?
    Waiting 4 reply.

  • Call a web service in ABAP - how to do LPCONFIG?

    I have searched through OSS, SAP help and SDN - and I see the answer if I call a web service from Java - but I cannot find the answer if I call a web service through normal ABAP in R/3.
    I apologize if I am asking the same question again or if it is already there and I am just overlooking it.
    I am creating a client proxy in R/3 to call an outside web service through ABAP.
    I create the client proxy in our test system using SE80.
    I create a logical port using LPCONFIG to point at the test web service on the other system.
    I code the ABAP program - and everything works great.
    I transport the client proxy - and I transport the LPCONFIG information.
    Now I get into production - when I do transaction LPCONFIG to change the URL of the web service to be their production web service URL instead of their test web service URL - it asks for the system to be opened.
    Like it wants to create a transport. The basis people would have to open the system to be modified.  Which at least in our shop is not something we do.
    Here is the error:
      Message no. TK430
      The system administrator has set your logon client to the 'not modifiable' status.
      Client-specific objects can not be changed in this client.
      Contact the system administrator.
      For more information, see the SAP Library under Change and Transport System.
    For an ABAP program in R/3 using a client proxy - how do I call a test service in our test r/3 system and a production web service in production R/3 system without changing my ABAP code?
    Should this be done through LPCONFIG?
    Or what am I missing?
    Thanks for your help.
    Scott Overmeyer

    Hi Scott,
    Please refer to following URL
    http://help.sap.com/saphelp_nw04/helpdata/en/16/285d32996b25428dc2eedf2b0eadd8/content.htm
    I think you are using the second of the following 3 approaches mentioned in above documentation and so credential configuration is not available at run-time.
    Please check if this is helpful to you. If you have already looked at this then please ignore this message.
    There are three ways of configuring the call address of the Web service:
    ●     As HTTP destination: Select an RFC destination of type G (HTTP connection to an external server) or type H (HTTP connection to the SAP System) from transaction SM59. The HTTP destination approves the configuration of the logon procedure, encryption, and state management. This is the preferred access procedure.
    ●     As URL: The URL of the Web service is written to the corresponding input field when you create the logical port. The disadvantage of this procedure is that, with the exception of the URL, no other parameters for logging on, encryption, or state management can be configured. This is possible only for Web services that do not require a logon procedure, encryption, or state management.
    ●     As local path prefix: This access procedure is only intended for accessing your own system. Here you call the default RFC destination NONE to address your own server. The specified local path prefix is used to identify the called Web service.
    Regards,
    Vandana.

  • How to Trigger CAF web services from java Job schedulers?

    Hi Experts,
    I am in need of calling CAF based web services from custom Job scheduler.
    Could you please provide your idea and input if anyway we can call such web service by java api in custom jobs development?
    Thing is that we have CAF BO which hold around 1 million record (master data) and based on approval scenario (developed in WDJ apps) we will have to move this record to another business object for further manipulation?
    Hence due to huge number of record in BO, I would like to automate this activity by calling Jobs from WDJ apps and then Job will trigger the CAF web service which would create record into the BO object.
    Please share your idea and let me if it can be achievable by java apis to trigger Jobs by WDJ apps & webservice by jobs?
    Thanks & Regards,
    Pankaj

    Hi Experts,
    I am in need of calling CAF based web services from custom Job scheduler.
    Could you please provide your idea and input if anyway we can call such web service by java api in custom jobs development?
    Thing is that we have CAF BO which hold around 1 million record (master data) and based on approval scenario (developed in WDJ apps) we will have to move this record to another business object for further manipulation?
    Hence due to huge number of record in BO, I would like to automate this activity by calling Jobs from WDJ apps and then Job will trigger the CAF web service which would create record into the BO object.
    Please share your idea and let me if it can be achievable by java apis to trigger Jobs by WDJ apps & webservice by jobs?
    Thanks & Regards,
    Pankaj

  • Calling a web service through SSL via a stand alone java class

    HI,
    I am trying to call a web service through SSL via a simple stand alone java client.
    I have imported the SSL certificate in my keystore by using the keytool -import command.
    Basically I want to add a user to a group on the server. Say I add a user user 1 to group group 1 using an admin userid and password. All these values are set in an xml file which I send to the server while calling the server. I pass the web service URL, the soap action name and the xml to post as the command line arguments to the java client.
    My xml file(Add.xml) that is posted looks like :
    <?xml version="1.0" encoding="UTF-8"?>
    <SOAP-ENV:Envelope
    xmlns:xsi = "http://www.w3.org/1999/XMLSchema-instance"
    xmlns:SOAP-ENC = "http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:SOAP-ENV = "http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsd = "http://www.w3.org/1999/XMLSchema"
    SOAP-ENV:encodingStyle = "http://schemas.xmlsoap.org/soap/encoding/">
    <SOAP-ENV:Body>
    <namesp1:modifyGroupOperation xmlns:namesp1 = "/services/modifyGroup/modifyGroupOp">
    <auth>
    <user>adminUser</user>
    <password>adminPassword</password>
    </auth>
    <operationType>ADD</operationType>
    <groupName>group1</groupName>
    <users>
    <userName>user1</userName>
    </users>
    </namesp1:modifyGroupOperation>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    I call the client as:
    java PostXML https://com.webservice.com/services/modifyGroup "/services/modifyGroup/modifyGroupOp" Add.xml
    I my client, I have set the following:
    System.setProperty("javax.net.ssl.keyStore", "C:\\Program Files\\Java\\jre1.5.0_12\\lib\\security\\cacerts");
    System.setProperty("javax.net.ssl.keyStorePassword", "password");
    System.setProperty("javax.net.ssl.trustStore", "C:\\Program Files\\Java\\jre1.5.0_12\\lib\\security\\cacerts");
    System.setProperty("javax.net.ssl.trustStorePassword", "password");
    But when I try to execute the java client, I get the following error:
    setting up default SSLSocketFactory
    use default SunJSSE impl class: com.sun.net.ssl.internal.ssl.SSLSocketFactoryImpl
    class com.sun.net.ssl.internal.ssl.SSLSocketFactoryImpl is loaded
    keyStore is : C:\Program Files\Java\jre1.5.0_12\lib\security\cacerts
    keyStore type is : jks
    keyStore provider is :
    init keystore
    init keymanager of type SunX509
    trustStore is: C:\Program Files\Java\jre1.5.0_12\lib\security\cacerts
    trustStore type is : jks
    trustStore provider is :
    init truststore
    adding as trusted cert:
    init context
    trigger seeding of SecureRandom
    done seeding SecureRandom
    instantiated an instance of class com.sun.net.ssl.internal.ssl.SSLSocketFactoryImpl
    main, setSoTimeout(0) called
    main, setSoTimeout(0) called
    %% No cached client session
    *** ClientHello, TLSv1
    RandomCookie: GMT: .....
    Compression Methods: { 0 }
    [write] MD5 and SHA1 hashes: len = 73
    main, WRITE: TLSv1 Handshake, length = 73
    [write] MD5 and SHA1 hashes: len = 98
    main, WRITE: SSLv2 client hello message, length = 98
    [Raw write]: length = 100
    [Raw read]: length = 5
    [Raw read]: length = 58
    main, READ: TLSv1 Handshake, length = 58
    *** ServerHello, TLSv1
    %% Created: [Session-1, SSL_RSA_WITH_RC4_128_MD5]
    ** SSL_RSA_WITH_RC4_128_MD5
    [read] MD5 and SHA1 hashes: len = 58
    [Raw read]: length = 5
    [Raw read]: length = 5530
    main, READ: TLSv1 Handshake, length = 5530
    *** Certificate chain
    chain [0] = ...
    chain [1] = ...
    chain [2] = ...
    chain [3] = ...
    main, SEND TLSv1 ALERT: fatal, description = certificate_unknown
    main, WRITE: TLSv1 Alert, length = 2
    [Raw write]: length = 7
    0000: 15 03 01 00 02 02 2E .......
    main, called closeSocket()
    main, handling exception: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    main, called close()
    main, called closeInternal(true)
    main, called close()
    main, called closeInternal(true)
    main, called close()
    main, called closeInternal(true)
    Exception in thread "main" javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.c
    ertpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Unknown Source)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(Unknown Source)
    at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Unknown Source)
    at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Unknown Source)
    at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(Unknown Source)
    at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(Unknown Source)
    at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Unknown Source)
    at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Unknown Source)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(Unknown Source)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecord(Unknown Source)
    at com.sun.net.ssl.internal.ssl.AppOutputStream.write(Unknown Source)
    at java.io.BufferedOutputStream.flushBuffer(Unknown Source)
    at java.io.BufferedOutputStream.flush(Unknown Source)
    at org.apache.commons.httpclient.methods.EntityEnclosingMethod.writeRequestBody(EntityEnclosingMethod.java:506)
    at org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:2110)
    at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1088)
    at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398)
    at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
    at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
    at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)
    at PostXML.main(PostXML.java:111)
    Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find v
    alid certification path to requested target
    at sun.security.validator.PKIXValidator.doBuild(Unknown Source)
    at sun.security.validator.PKIXValidator.engineValidate(Unknown Source)
    at sun.security.validator.Validator.validate(Unknown Source)
    at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(Unknown Source)
    at com.sun.net.ssl.internal.ssl.JsseX509TrustManager.checkServerTrusted(Unknown Source)
    ... 18 more
    Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(Unknown Source)
    at java.security.cert.CertPathBuilder.build(Unknown Source)
    ... 23 more
    I do not know where I have gone wrong. Could someone point out my mistake.
    Thanks In advance!

    Hi jazz123,
    There's an example in the [*Java Web Services Tutorial*|http://java.sun.com/webservices/docs/2.0/tutorial/doc/] : see Chapter 1: Building Web Services with JAX-WS - A Simple JAX-WS Client.

  • Calling a web service from a servlet via stub: java.lang.reflect.Invocation

    Hi all, I'm developping my first web application using Apache Tomcat and Axis, using servlets, jsp and web services.
    My problem is that I cannot make any call to my web service (a very simple one) because I get the following exception:
    <code>
    java.lang.reflect.InvocationTargetException CAUSA: null
    AxisFault
    faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
    faultSubcode:
    faultString: java.lang.reflect.InvocationTargetException
    faultActor:
    faultNode:
    faultDetail:
    {http://xml.apache.org/axis/}hostname:lexis02
    java.lang.reflect.InvocationTargetException
    at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)
    at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)
    at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
    </code>
    The stack trace is longer than that, but I didn't find any hints to solve the problem.
    The exception is thrown for every method of the web service:

    public java.lang.String[] getMessage(java.lang.String , int) throws java.rmi.RemoteException
    public boolean addMessage(java.lang.String, java.lang.String, int)
    throws java.rmi.RemoteException
    I'm using stub to call the web service, as generated by wsdl tool.
    Can someone help me?
    Thanx
    PS: sorry for the double message but I pressed the wronk key at the wrong time :)

  • Calling a web service from a Java application

    Does anyone have sample code showing how to call a web service over from a Java application? I'm deploy to HP-UX and seeking out the most standard and reliable approach.
    Thank you in advance.

    Keith,
    Download JWSDP 1.2, look at the tutorial for JAXRPC, especially
    the client portion.

  • Calling Web service from Java Concurrent Program

    Hi,
    I created a Java concurrent program and created executable. Here is my code.
        public void runProgram(CpContext ctx) {
            String value = "Java Concurrent Program Testing";
            Hello hell = new Hello();
            String returnValue = hell.testURL(value);
            if(returnValue.equalsIgnoreCase("TRUE")){
                ctx.getLogFile().writeln("-- Java Concurrent Program Testing --", 0);
                ctx.getOutFile().writeln("-- Java Concurrent Program Testing --");
                ctx.getReqCompletion().setCompletion(ReqCompletion.NORMAL, "");
            else{
                ctx.getLogFile().writeln("-- Hello World! --", 0);
                ctx.getOutFile().writeln("-- Hello World! --");
                ctx.getReqCompletion().setCompletion(ReqCompletion.NORMAL, "");
        }testURL() call the web service and get the response. but when I am selecting View Output option I am always geting out put as
    -- Hello World! --I tested the logic of calling web service. It giving me out put "true". Here is my Web service calling code
        public String testURL(String Value){
            HttpURLConnection httpConn = null;
            ByteArrayOutputStream bout = null;
            String setWebServiceURLResponse = "";
            String responseString="";
            String outputString = "";
            try{
                httpConn = getHttpConnection();
                bout = new ByteArrayOutputStream();
                String xmlInput = soapBodyStart +
                "<ns1:getTestURL>\n" +
                "            <ns1:URL>"+Value+"</ns1:URL>\n" +
                "        </ns1:getTestURL>"+
                soapBodyEnd;
                byte[] buffer = new byte[xmlInput.length()];
                buffer = xmlInput.getBytes();
                bout.write(buffer);
                byte[] b = bout.toByteArray();
                httpConn = setHttpConnectionRequest(b,httpConn);
                //Read the response.
                InputStreamReader isr = new InputStreamReader(httpConn.getInputStream());
                BufferedReader in = new BufferedReader(isr);
                //Write the SOAP message response to a String.
                while ((responseString = in.readLine()) != null) {
                    outputString = outputString + responseString;
                //Parse the String output to a org.w3c.dom.Document and be able to reach every node with the org.w3c.dom API.
                Document document = parseXmlFile(outputString);
                String formattedSOAPResponse = formatXML(outputString);
                System.out.println("Formatted response = \n" +formattedSOAPResponse);
                //NodeList nodes = document.getElementsByTagName("setWebServiceURLResponse");
                //NodeList nodes = document.getElementsByTagName("getTestURLResponse");
                 NodeList nodes = document.getElementsByTagName("ns0:getTestURLResponse");
                int len = nodes.getLength();
                System.out.println("Inside testURL Node Lenght  = "+ len);
                for(int s=0; s<nodes.getLength() ; s++){
                    Node authenticateResultNode = nodes.item(s);
                    if(authenticateResultNode.getNodeType() == Node.ELEMENT_NODE){
                        Element authenticateResultElement = (Element)authenticateResultNode;
                        //NodeList authenticateResultValueNode = authenticateResultElement.getElementsByTagName("ns0:return");
                        //NodeList authenticateResultValueNode = authenticateResultElement.getElementsByTagName("return");
                         NodeList authenticateResultValueNode = authenticateResultElement.getElementsByTagName("ns0:return");
                        Element authenticateResultValue = (Element)authenticateResultValueNode.item(0);
                        NodeList textFNList = authenticateResultValue.getChildNodes();
                        //System.out.println("Authenticate Result : " + ((Node)textFNList.item(0)).getNodeValue().trim());
                         setWebServiceURLResponse = ((Node)textFNList.item(0)).getNodeValue();
                         //System.out.println("Authenticate Response in getAuthenticate method : " + authenticateresponse);
                    }//end of if clause
                }//end of for loop with s var
                System.out.println("Inside setWebServcieURLToFile response = " + setWebServiceURLResponse);
            catch(Exception e){
                e.printStackTrace();
            return setWebServiceURLResponse;
        }Where I am going wrong ?
    Regards,
    Ajay Sharma

    sample code:
    static string url = "http://my.webservice.url"; ---------------> The actual web service URL
    Call = new Call(url); --------------------------------------------------> The call object used by JAX-RPC
    Object[] params = new Object[]{param1, param2};---------> build the call parameters
    Boolean/Integer/Whatever result = call.invoke("method name", params);------>call the invoke method to get the result

  • Calling web service from Java

    Hi,
    Can anyone help me in calling a web service url from java client?
    Regds,
    Nandakumar

    sample code:
    static string url = "http://my.webservice.url"; ---------------> The actual web service URL
    Call = new Call(url); --------------------------------------------------> The call object used by JAX-RPC
    Object[] params = new Object[]{param1, param2};---------> build the call parameters
    Boolean/Integer/Whatever result = call.invoke("method name", params);------>call the invoke method to get the result

  • Problem in calling XI generated Web Service via Java Web Dynpro

    Hi experts,
    I have problems with calling a web service, which was created by XI. I have already tested the web service with Altova XMLSpy. The Web Service works fine.
    But when embedding this web service into Java Web dynpro application no message flow is given. I have two views one Selection View and one Result View which should show the answer sent by RFC-Call.
    <b>My Settings in NWDS:</b>
    During configuration of web dynpro I have choosen 'Import adaptive Web Service Model' --> Select wsdl file via local file system --> 'no logical destinations - use WSDL URL for metadata retrieval and web service execution'.
    The model is also not shown in diagram view although I have added into the diagram.
    The web service was created on XI 7.0.
    Should I do any other settings e.g. in Visual Administrator, Web Dynpro Content Administrator?
    So can anybody help me.
    Thanks a lot.
    Regards,
    Mario

    Hi Aviad,
    thanks for your fast reply.
    But in Web Service Navigator my Web Service is not shown, because I used the SOAP Adapter.
    <b>My Web Service link:</b>
    http://<host>:<port>/XISOAPAdapter/MessageServlet?channel=:SRV_GBD_WS_GET_DEB_DETAIL:CC_GBD_WEBSERVICE_SENDER&amp;version=3.0&amp;Sender.Service=&amp;Interface=%5E*
    During executing Web Dynpro I got following errors:
    1. 'The system cannot find the path specified'.
    2. com.sap.tc.webdynpro.model.webservice.exception.WSModelRuntimeException: Exception on creation of service metadata for WSDL URL
    Regards,
    Mario

Maybe you are looking for

  • Adding custom fields in screen

    I have added two custom fields in QUOTATION(VA21) in additional data tab B...when i create quotation for a particular sales order i am getting the fields in VBAK table and the issue is while creating sales order for the same i have to get these field

  • IPod 5G 60GB invisible to Mac after iTunes/iPod update

    The battery icon on the iPod shows that it is charging when the cable is connected, but that's all I get now. Even in Disk Mode, it won't show in Disk Utility. Have done the reset many many times and the manual disk mode setting at least half of thos

  • App for editing/reading/writing Excel, Word, Windows notepad text documents

    I was wondering if any of you's could recommend some apps (from experience) that would allow me to, edit/read/write Excel, Word, Windows notepad text documents. I could make do with an app that would do the above but without the ability to create, ed

  • Regarding Design of background color in a Web Dynpro Table

    Hi I have a Web Dynpro UI Element Table having two colums and some rows. I wished to set the background color of the rows to white instead of default blue. Can anyone help me how to implement this? Regards Sreekar

  • Error navigating from OBIEE Dashboards 11g to BI Publisher

    Environment: WebLogic Server 10.3.5 OBIEE 11.1.1.5 AIX 6.1 Browser: IE8 (company standard) and others like Firefox Hitting the links on browser in OBIEE dashboard to create a Published Report in BI Publisher, I get the following error: Webpage error