Cmd-line client for web service

Hi there,
I'm new to Sun Java Studio, but generally familiar with the technology. So far I managed to build a web service and to register it.
Now I would like to build a simple cmd-line client to invoke this web services. I couldn't find anything in the "documentation" or "tutorial". Does anybody has some sample code?
Thanks,
Andreas

The tutorial http://www.netbeans.org/kb/50/quickstart-webservice-client.html provides a sample for developing a standalone client that consumes a webservice.
The tutorial is for NetBeans 5.0 (http://www.netbeans.info/downloads/download.php?type=5.0) but should be applicable for JSE8 (based on NB4.1).

Similar Messages

  • F-44  ZBAPI MULTIPLE LINE SELECTIONS FOR WEB SERVICES

    HI TO ALL,
              I HAVE WRITTEN ZBAPI FOR POSTING MULTIPLE LINE SELECTIONS FOR TCODE F-44, THE ZBAPI  CONSIST OF BDC PROGRAM, WHICH IS WORKING IN SAP SYSTEM PERFECTLY BUT WHEN I AM USING IT IN WEB SERVICES IT IS THROWING A  ERROR MESSAGE.
                     PLEASE CAN ANY ONE TELL ME DOES THIS PROCESS WILL WORK OR NOT, IF YES HOW IS IT POSSIBLE

    Hi Gabriel,
    Let me try to answer some of your questions:
    1) The "Requires Secure Access" attribute of a resource handler controls whether this handler must be accessed/consumed only over SSL (HTTPS). Oracle Database Cloud Schema Service is only offered over SSL, so this attribute does not have any effect on RESTful services deployed in this environment (because secure access is always required and there is no other way). That said, if you want to access such web service from your own APEX instance, your instance must have Oracle Wallet configured with appropriate SSL certificate.
    2) The URI parameters are not required. If your web service returns data for many entities (for example, list of employees in employees/), you may not need a parameter. If your web service returns data for one specific entity (for example, details of one employee in employees/{id}), you may want to identify that entity with a URI parameter.
    3) You can have many URI parameters, for example: customers/{id}/orders/{order_id}.
    4) Yes, these are the same HTTP methods/verbs you would use from PHP.
    5) If you are trying this POST example from your own APEX instance (not Oracle Database Cloud Schema Service) and you are trying to access a web service over SSL, then it is likely that the Oracle Wallet used by your instance does not include the required SSL certificate(s), or the Oracle Wallet is not configured at all.
    6) I recommend to check RESTful Web Services for the Oracle Database Cloud white paper and Oracle REST Data Services Developers Guide. Oracle REST Data Services is the technology that enables RESTful services in the Oracle Database Cloud Schema Service.
    You can certainly create your own web services in the Oracle Database Cloud Schema Service and consume them from the same environment.
    Vlad

  • Mutual Authentication client for Web Service

    Hi,
    How I can tell java to use this particular client certificate in mutual authentication.
    I have two certificates
    1) cacert.pem and
    2) client.pem (includes private key),
    client.pem is signed by cacert.pem and also contains the private key. I have the wsdl file for the webservice that I have to call and I can generate java wrappers of it using wsdl2java.
    Infact I just called web services that used Server-Only SSL/TLS authentication, in that case I just had to add root/CA certificate (in cer format) in the JREs cacerts file and used https for the webservice url, and all worked file
    Now I can't understand what to do for mutual authentication.
    Thanks in advance.
    Sohaib

    Hi,
    How I can tell java to use this particular client certificate in mutual authentication.
    I have two certificates
    1) cacert.pem and
    2) client.pem (includes private key),
    client.pem is signed by cacert.pem and also contains the private key. I have the wsdl file for the webservice that I have to call and I can generate java wrappers of it using wsdl2java.
    Infact I just called web services that used Server-Only SSL/TLS authentication, in that case I just had to add root/CA certificate (in cer format) in the JREs cacerts file and used https for the webservice url, and all worked file
    Now I can't understand what to do for mutual authentication.
    Thanks in advance.
    Sohaib

  • Starting out with Java client for Web Services

    Hi,
    I'm new to Web Services (but not Java in general). Just looking for some pointers to get me started in the right direction.
    My pressing need is to develop a Java client for a set of Web Services described through a WSDL.
    I've found the "Chapter 12: Building Web Services With JAX-RPC" section of the Web Services Tutorial. Could someone just confirm that this is the right tutorial for me to read for my puropse.
    Also I was wondering about available tools for this purpose.
    I was expecting that there would be a tool that could read a WSDL and generate client side stubs for it automatically. (Like how you can take a Remote interface and rmic it in RMI). Is there such a thing? Is it possible?
    Preferably an open source (free) tool. I use the Netbeans IDE so if anyone knows of anything that integrates with that, all the better. I had a look at their site but couldn't see anything.
    Thanks in advance for any tips anyone can provide.

    Hi,
    I'm new to Web Services (but not Java in general).
    Just looking for some pointers to get me started in
    the right direction.
    My pressing need is to develop a Java client for a set
    of Web Services described through a WSDL.
    I've found the "Chapter 12: Building Web Services
    With JAX-RPC" section of the Web Services Tutorial.
    Could someone just confirm that this is the right
    tutorial for me to read for my puropse.Yes, that's right. It manages to say very little in very many pages.
    Also I was wondering about available tools for this
    purpose.
    I was expecting that there would be a tool that could
    read a WSDL and generate client side stubs for it
    automatically. (Like how you can take a Remote
    interface and rmic it in RMI). Is there such a thing?
    Is it possible?This is exactly what the wscompile tool (distributed with the JWS SDK 1.3) does as one of its options. See http://java.sun.com/webservices/docs/1.1/tutorial/doc/JAXRPC6.html for more info.

  • Simple Client for web service ...Perl way

    II need to get information from a web service (with a defined WSDL)...I have been able to do that with Perl ((using SOAP:Lite) which is pretty staight forward....
    I was trying to do the same with Java ..I tried to find tutorials ...but was overwhelmed with the amount of information ..in there .(They talk about writing the server installing axis etc ..but fail interms of a simple explanation to create a simple client
    I was wondering if you could help me to get hold of a tutorial/resource which helps in simply creating a connection and getting information from the remote application...

    hi
    writing webservices using tomcat and axis is pretty easy ..... you have to create a java class to describe your service .... and save it in the axis subdirectory of tomcat .... and call the service from a client on a remote machine using the IP address and port details ...

  • "Connection refused" when using Java client for Web Service

    I deployed a web service to Weblogic Server 7.0 running on Windows 2000. I can
    use IE browser to see its WSDL perfectly but when I run the Java client, the proxy
    method call generates the following error:
    java.net.ConnectException: Connection refused: connect
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
    at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
    at java.net.Socket.connect(Socket.java:426)
    at java.net.Socket.connect(Socket.java:376)
    at java.net.Socket.<init>(Socket.java:291)
    at java.net.Socket.<init>(Socket.java:119)
    at weblogic.webservice.binding.soap.HttpClientBinding.createSocket(HttpC
    lientBinding.java:412)
    at weblogic.webservice.binding.soap.HttpClientBinding.createSocket(HttpC
    lientBinding.java:390)
    at weblogic.webservice.binding.soap.HttpClientBinding.send(HttpClientBin
    ding.java:246)
    at weblogic.webservice.core.handler.ClientHandler.handleRequest(ClientHa
    ndler.java:34)
    at weblogic.webservice.core.HandlerChain.handleRequest(HandlerChain.java
    :131)
    at weblogic.webservice.core.DefaultOperation.invoke(DefaultOperation.jav
    a:417)
    at weblogic.webservice.core.DefaultOperation.invoke(DefaultOperation.jav
    a:359)
    at weblogic.webservice.core.rpc.StubImpl._invoke(StubImpl.java:225)
    at weblogic.jws.proxies.CenterWSSoap_Stub.update(CenterWSSoap_Stub.java:
    181)
    at weblogic.jws.proxies.CenterWSSoap_Stub.update(CenterWSSoap_Stub.java:
    207)
    at CenterWSClient.main(CenterWSClient.java:73)
    javax.xml.rpc.JAXRPCException: Failed to send request:java.net.ConnectException:
    Connection refused: connect
    at weblogic.webservice.core.handler.ClientHandler.handleRequest(ClientHa
    ndler.java:37)
    at weblogic.webservice.core.HandlerChain.handleRequest(HandlerChain.java
    :131)
    at weblogic.webservice.core.DefaultOperation.invoke(DefaultOperation.jav
    a:417)
    at weblogic.webservice.core.DefaultOperation.invoke(DefaultOperation.jav
    a:359)
    at weblogic.webservice.core.rpc.StubImpl._invoke(StubImpl.java:225)
    at weblogic.jws.proxies.CenterWSSoap_Stub.update(CenterWSSoap_Stub.java:
    181)
    at weblogic.jws.proxies.CenterWSSoap_Stub.update(CenterWSSoap_Stub.java:
    207)
    at CenterWSClient.main(CenterWSClient.java:73)
    Exception in handler's handleRequest().
    java.rmi.RemoteException: SOAP Fault:javax.xml.rpc.soap.SOAPFaultException: Conn
    ection refused: connect; nested exception is:
    javax.xml.rpc.soap.SOAPFaultException: Connection refused: connect
    at weblogic.jws.proxies.CenterWSSoap_Stub.update(CenterWSSoap_Stub.java:
    186)
    at weblogic.jws.proxies.CenterWSSoap_Stub.update(CenterWSSoap_Stub.java:
    207)
    at CenterWSClient.main(CenterWSClient.java:73)
    Caused by: javax.xml.rpc.soap.SOAPFaultException: Connection refused: connect
    at weblogic.webservice.core.DefaultOperation.invoke(DefaultOperation.jav
    a:459)
    at weblogic.webservice.core.DefaultOperation.invoke(DefaultOperation.jav
    a:359)
    at weblogic.webservice.core.rpc.StubImpl._invoke(StubImpl.java:225)
    at weblogic.jws.proxies.CenterWSSoap_Stub.update(CenterWSSoap_Stub.java:
    181)

    In your client program, when you do "new XXX_Impl(String wsdlurl)", did you
    pass in the wsdl you were hitting with browser?
    -Neal
    "Ray Yan" <[email protected]> wrote in message
    news:[email protected]...
    >
    I deployed a web service to Weblogic Server 7.0 running on Windows 2000. Ican
    use IE browser to see its WSDL perfectly but when I run the Java client,the proxy
    method call generates the following error:
    java.net.ConnectException: Connection refused: connect
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
    atjava.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
    at java.net.Socket.connect(Socket.java:426)
    at java.net.Socket.connect(Socket.java:376)
    at java.net.Socket.<init>(Socket.java:291)
    at java.net.Socket.<init>(Socket.java:119)
    atweblogic.webservice.binding.soap.HttpClientBinding.createSocket(HttpC
    lientBinding.java:412)
    atweblogic.webservice.binding.soap.HttpClientBinding.createSocket(HttpC
    lientBinding.java:390)
    atweblogic.webservice.binding.soap.HttpClientBinding.send(HttpClientBin
    ding.java:246)
    atweblogic.webservice.core.handler.ClientHandler.handleRequest(ClientHa
    ndler.java:34)
    atweblogic.webservice.core.HandlerChain.handleRequest(HandlerChain.java
    :131)
    atweblogic.webservice.core.DefaultOperation.invoke(DefaultOperation.jav
    a:417)
    atweblogic.webservice.core.DefaultOperation.invoke(DefaultOperation.jav
    a:359)
    atweblogic.webservice.core.rpc.StubImpl._invoke(StubImpl.java:225)
    atweblogic.jws.proxies.CenterWSSoap_Stub.update(CenterWSSoap_Stub.java:
    181)
    atweblogic.jws.proxies.CenterWSSoap_Stub.update(CenterWSSoap_Stub.java:
    207)
    at CenterWSClient.main(CenterWSClient.java:73)
    javax.xml.rpc.JAXRPCException: Failed to sendrequest:java.net.ConnectException:
    Connection refused: connect
    atweblogic.webservice.core.handler.ClientHandler.handleRequest(ClientHa
    ndler.java:37)
    atweblogic.webservice.core.HandlerChain.handleRequest(HandlerChain.java
    :131)
    atweblogic.webservice.core.DefaultOperation.invoke(DefaultOperation.jav
    a:417)
    atweblogic.webservice.core.DefaultOperation.invoke(DefaultOperation.jav
    a:359)
    atweblogic.webservice.core.rpc.StubImpl._invoke(StubImpl.java:225)
    atweblogic.jws.proxies.CenterWSSoap_Stub.update(CenterWSSoap_Stub.java:
    181)
    atweblogic.jws.proxies.CenterWSSoap_Stub.update(CenterWSSoap_Stub.java:
    207)
    at CenterWSClient.main(CenterWSClient.java:73)
    Exception in handler's handleRequest().
    java.rmi.RemoteException: SOAPFault:javax.xml.rpc.soap.SOAPFaultException: Conn
    ection refused: connect; nested exception is:
    javax.xml.rpc.soap.SOAPFaultException: Connection refused: connect
    atweblogic.jws.proxies.CenterWSSoap_Stub.update(CenterWSSoap_Stub.java:
    186)
    atweblogic.jws.proxies.CenterWSSoap_Stub.update(CenterWSSoap_Stub.java:
    207)
    at CenterWSClient.main(CenterWSClient.java:73)
    Caused by: javax.xml.rpc.soap.SOAPFaultException: Connection refused:connect
    atweblogic.webservice.core.DefaultOperation.invoke(DefaultOperation.jav
    a:459)
    atweblogic.webservice.core.DefaultOperation.invoke(DefaultOperation.jav
    a:359)
    atweblogic.webservice.core.rpc.StubImpl._invoke(StubImpl.java:225)
    atweblogic.jws.proxies.CenterWSSoap_Stub.update(CenterWSSoap_Stub.java:
    181)

  • Building client proxies for web services with SOAP attachemtns

    Hi all.
    I'm currently building a series of web services that take SOAP attachments as
    input, but I am unable to generate the java proxies for testing the services via
    WebLogic Workshop 8.1. When I attempt to build the proxy, I get the following
    error:
    Warning: Failed to generate client proxy from WSDL definition for this service.
    Suggestion: Please verify the <types> section of the WSDL.
    Is there something I need to alter to get this to work, or does workshop not support
    client proxies for web services with DataHandler parameters?
    Thanks.
    -Brian

    Thanks for the help. This is my first web service with SOAP attachments, so it
    may have been a long time till I realized that.
    -Brian
    "Michael Wooten" <[email protected]> wrote:
    >
    Thanks Brian,
    The problem is that you are trying to use the "document" soap-style :-)
    If you change this to "rpc", you'll should be able to successfully generate
    the
    client proxy jar. The soap-style property, is at the bottom of the "protocol"
    property sheet section, for the JWS.
    Regards,
    Mike Wooten
    "Brian McLoughlin" <[email protected]> wrote:
    Sure, sorry about that. Attached is the wsdl for a sample web service
    I created
    just to test the proxy generation.
    "Michael Wooten" <[email protected]> wrote:
    Hi Brian,
    Would it be possible for you to post the WSDL, so we can see what might
    be causing
    the problem?
    Regards,
    Mike Wooten
    "Brian McLoughlin" <[email protected]> wrote:
    Hi all.
    I'm currently building a series of web services that take SOAP attachments
    as
    input, but I am unable to generate the java proxies for testing theservices
    via
    WebLogic Workshop 8.1. When I attempt to build the proxy, I get the
    following
    error:
    Warning: Failed to generate client proxy from WSDL definition for
    this
    service.
    Suggestion: Please verify the <types> section of the WSDL.
    Is there something I need to alter to get this to work, or does workshop
    not support
    client proxies for web services with DataHandler parameters?
    Thanks.
    -Brian

  • Using Eclipse Ant tasks - for web service client creation

    Hi,
    I am following Eclipse documentation for creating Axis runtime environment web services and clients using web services Ant tasks.
    As per document when I import Ant files into workspace, files that will be imported are wsgen.xml (Ant file) , axisservice.properties and axisclient.properties but for me these files are not getting imported into the project instead files axis_bujava.properties and axis_bujava.xml are imported.
    Please do let me know if anyone have any ideas on this asap.
    Thanks,
    Roopa.

    Hi,
    I am following Eclipse documentation for creating Axis runtime environment web services and clients using web services Ant tasks.
    As per document when I import Ant files into workspace, files that will be imported are wsgen.xml (Ant file) , axisservice.properties and axisclient.properties but for me these files are not getting imported into the project instead files axis_bujava.properties and axis_bujava.xml are imported.
    Please do let me know if anyone have any ideas on this asap.
    Thanks,
    Roopa.

  • Java client for OSB service

    Hi All,
    We have to talk to OSB11g proxy service which is created as Any Soap service (url: http://myosb.firmname.com:7001/osb-ws)
    I have java client applications which need to consume this proxy service built on top of OSB by providing the necessary inputs.
    Typically we get wsdl url's and then we use Jdeveloper to create web service client proxies to generate client side web service artifacts and call the web service.
    But I am confused here as to how can I get a handle to the OSB service from a java client. The OSB developers on the project tell me they don't have and cannot provide a WSDL based URL.
    What are the general practices for consuming OSB proxy service from java client apps. Google search result did not yield much help.
    Please let me know your thoughts.
    Regards,

    Hi Anuj,
    Thanks for reply. As u guys mentioned that about the URL I have rechecked the URL and realized the port number which I was using that was Admin Server Port while environment contains two servers Admin and Managed both. I have change the Port Number from Admin to Managed now its hitting the Service but now another problem I start facing that I need to pass a big XML as input request to that OSB Proxy Service. I have two different code where I am attaching the input request in two different ways but none of them is passing that request to URL and in both cases I am getting default response from URL.
    Here is the Code, Code1 through Core Java:
    ===============================================================================================
    package retriggerpsftorder;
    import java.io.BufferedReader;
    import java.io.InputStreamReader;
    import java.io.OutputStreamWriter;
    import java.net.URL;
    import java.net.URLConnection;
    import java.net.URLEncoder;
    public class MyTest {
    public MyTest() {
    System.out.println("Constructor executing");
    System.out.println("JAVA Version : " + System.getProperty("JAVA.VERSION"));
    public static void main(String arga[]) {
    try {
    // Construct data
    String data = URLEncoder.encode("key1", "UTF-8") + "=" + URLEncoder.encode("<migrateOrder>\n" +
    " <migrateOrderId>51c797d61dd211b2818a</migrateOrderId>\n" +
    " <createCustomer>false</createCustomer>\n" +
    " <createBillingAccount>false</createBillingAccount>\n" +
    " <Customer>\n" +
    " <ID>\n" +
    " </PIN>\n" +
    "     </customerAccountNumber\"></customerAccountNumber\">\n" +
    " </externalIdentifier>\n" +
    " </ID>\n" +
    " <creditClass>W</creditClass>\n" +
    " </Customer>\n" +
    " <Account>\n" +
    " <name>Gurwinder Singh</name>\n" +
    " <ID>\n" +
    " <PIN>1987</PIN>\n" +
    "     <billingAccountNumber>695909361</billingAccountNumber>\n" +
    " </ID>\n" +
    " </Account>\n" +
    " <CustomerOrder>\n" +
    " <customerOrderPartyReference>\n" +
    " <MSISDN>61425265789</MSISDN>\n" +
    " </customerOrderPartyReference>\n" +
    " <orderSource>\n" +
    " <templateName>AUP1057_AU10357_24_DATA_0113</templateName>\n" +
    " </orderSource>\n" +
    " <typeCode>Connect</typeCode>\n" +
    " <futureSubmitDate>2011-02-28</futureSubmitDate>\n" +
    " <cancelOpenOrdersIndicator>false</cancelOpenOrdersIndicator>\n" +
    " <lineItem actionCode=\"Add\" priorityRanking=\"1\">\n" +
    " <product ID=\"AUX221\" type=\"SAMID\" attributeCount=\"19\">\n" +
    " <attribute>\n" +
    " <name>Accept Code</name>\n" +
    " <value>Accept 5</value>\n" +
    " </attribute>\n" +
    " </product>\n" +
    " </lineItem>\n" +
    " <lineItem actionCode=\"Add\" priorityRanking=\"2\">\n" +
    " <product ID=\"OFF0018\" type=\"SAMID\" attributeCount=\"1\">\n" +
    " <attribute>\n" +
    " <name>Period Override</name>\n" +
    " <value>24</value>\n" +
    " </attribute>\n" +
    " </product>\n" +
    " </lineItem>\n" +
    " <lineItem actionCode=\"Allocate\" priorityRanking=\"3\">\n" +
    " <equipment ID=\"012645002053476\" type=\"Handset\" />\n" +
    " </lineItem>\n" +
    " <lineItem actionCode=\"Allocate\" priorityRanking=\"4\">\n" +
    " <resource ID=\"89610300000905636996\" type=\"SIM\" />\n" +
    " </lineItem>\n" +
    " <externalOrderReference>\n" +
    " <serviceID>75055433</serviceID>\n" +
    " <customerID>921092224696621123154029260421</customerID>\n" +
    " <serviceStartDate>2009-02-10</serviceStartDate>\n" +
    " <serviceRatePlan>X3Cap $29 24m($29min-35cFF)</serviceRatePlan>\n" +
    " <agreementNumber>VHU0029215</agreementNumber>\n" +
    " <accountNumber>3382437469</accountNumber>\n" +
    " <migrationType>Loyalty Handset Upgrade Acq</migrationType>\n" +
    " <receiveMarketingInfoOverrideIndicator>false</receiveMarketingInfoOverrideIndicator>\n" +
    " </externalOrderReference>\n" +
    " <orderSalesReference>\n" +
    " <dealerReferenceID>D3641</dealerReferenceID>\n" +
    " <trailingCommissionRatePlan>MUPR9</trailingCommissionRatePlan>\n" +
    " <trailingCommisionDealerReference>D3734</trailingCommisionDealerReference>\n" +
    " </orderSalesReference>\n" +
    " </CustomerOrder>\n" +
    " <ContactManagementActivity>\n" +
    " <activityCategory>Proof of Purchase - Mig from 3</activityCategory>\n" +
    " <activityType>Migration from 3</activityType>\n" +
    " <activityDescription>Proof of Purchase Information</activityDescription>\n" +
    " <activityComment>MSISDN: 0425265789354610026170561</activityComment>\n" +
    " </ContactManagementActivity>\n" +
    "</migrateOrder>\n", "UTF-8");
    //data += "&" + URLEncoder.encode("key2", "UTF-8") + "=" + URLEncoder.encode("value2", "UTF-8");
    System.out.println("Data going for Request : "+data);
    // Send data
    URL url = new URL("http://172.22.161.101:8017/app/mig3/migrate/MigrateOrder");
    URLConnection conn = url.openConnection();
    conn.setDoOutput(true);
    OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
    wr.write(data);
    wr.flush();
    // Get the response
    BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
    int i=0;
    while ((line = rd.readLine()) != null) {
    System.out.println("Values of Line : "+ i + " : "+ line);// Process line...
    i++;
    wr.close();
    rd.close();
    } catch (Exception e) {
    =========================================
    Code 1 Response
    Values of Line : 0 : <?xml version="1.0" encoding="UTF-8"?>
    Values of Line : 1 : <migrateOrderReply><statusCode>Failed</statusCode><errorReturn><errorCode>CORE_SYS_GENERIC</errorCode><errorMessage>Unexpected System exception</errorMessage></errorReturn></migrateOrderReply>
    Process exited with exit code 0.
    Note: The above response message is the default response message, even if u not pass any input parameter then also the above message will come.
    ==========================================================================================================
    Code 2 : Using Servlet
    package retriggerpsftorder;
    import java.io.IOException;
    import java.io.PrintWriter;
    import javax.servlet.Servlet;
    import javax.servlet.ServletConfig;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import org.apache.http.client.HttpClient;
    import org.apache.commons.httpclient.HttpConnection;
    import org.apache.commons.httpclient.HttpState;
    import org.apache.commons.httpclient.NameValuePair;
    import org.apache.commons.httpclient.URI;
    import org.apache.commons.httpclient.methods.PostMethod;
    import org.apache.commons.httpclient.methods.RequestEntity;
    import org.apache.http.client.HttpClient;
    public class GIFTProcess extends HttpServlet implements Servlet {
    private static final String CONTENT_TYPE =
    "text/html; charset=windows-1252";
    public void init(ServletConfig config) throws ServletException {
    super.init(config);
    public void doGet(HttpServletRequest req,
    HttpServletResponse resp) throws ServletException,
    IOException {
    resp.setContentType(CONTENT_TYPE);
    PrintWriter out = resp.getWriter();
    try {
    NameValuePair nvpRtn =
    new NameValuePair("body", "<migrateOrder>\n" +
    " <migrateOrderId>51c797d61dd211b2818a</migrateOrderId>\n" +
    " <createCustomer>false</createCustomer>\n" +
    " <createBillingAccount>false</createBillingAccount>\n" +
    " <Customer>\n" + " <ID>\n" +
    " </PIN>\n" +
    "     </customerAccountNumber\"></customerAccountNumber\">\n" +
    " </externalIdentifier>\n" +
    " </ID>\n" +
    " <creditClass>W</creditClass>\n" +
    " </Customer>\n" + " <Account>\n" +
    " <name>Gurwinder Singh</name>\n" +
    " <ID>\n" + " <PIN>1987</PIN>\n" +
    "     <billingAccountNumber>695909361</billingAccountNumber>\n" +
    " </ID>\n" + " </Account>\n" +
    " <CustomerOrder>\n" +
    " <customerOrderPartyReference>\n" +
    " <MSISDN>61425265789</MSISDN>\n" +
    " </customerOrderPartyReference>\n" +
    " <orderSource>\n" +
    " <templateName>AUP1057_AU10357_24_DATA_0113</templateName>\n" +
    " </orderSource>\n" +
    " <typeCode>Connect</typeCode>\n" +
    " <futureSubmitDate>2011-02-28</futureSubmitDate>\n" +
    " <cancelOpenOrdersIndicator>false</cancelOpenOrdersIndicator>\n" +
    " <lineItem actionCode=\"Add\" priorityRanking=\"1\">\n" +
    " <product ID=\"AUX221\" type=\"SAMID\" attributeCount=\"19\">\n" +
    " <attribute>\n" +
    " <name>Accept Code</name>\n" +
    " <value>Accept 5</value>\n" +
    " </attribute>\n" +
    " </product>\n" + " </lineItem>\n" +
    " <lineItem actionCode=\"Add\" priorityRanking=\"2\">\n" +
    " <product ID=\"OFF0018\" type=\"SAMID\" attributeCount=\"1\">\n" +
    " <attribute>\n" +
    " <name>Period Override</name>\n" +
    " <value>24</value>\n" +
    " </attribute>\n" +
    " </product>\n" + " </lineItem>\n" +
    " <lineItem actionCode=\"Allocate\" priorityRanking=\"3\">\n" +
    " <equipment ID=\"012645002053476\" type=\"Handset\" />\n" +
    " </lineItem>\n" +
    " <lineItem actionCode=\"Allocate\" priorityRanking=\"4\">\n" +
    " <resource ID=\"89610300000905636996\" type=\"SIM\" />\n" +
    " </lineItem>\n" +
    " <externalOrderReference>\n" +
    " <serviceID>75055433</serviceID>\n" +
    " <customerID>921092224696621123154029260421</customerID>\n" +
    " <serviceStartDate>2009-02-10</serviceStartDate>\n" +
    " <serviceRatePlan>X3Cap $29 24m($29min-35cFF)</serviceRatePlan>\n" +
    " <agreementNumber>VHU0029215</agreementNumber>\n" +
    " <accountNumber>3382437469</accountNumber>\n" +
    " <migrationType>Loyalty Handset Upgrade Acq</migrationType>\n" +
    " <receiveMarketingInfoOverrideIndicator>false</receiveMarketingInfoOverrideIndicator>\n" +
    " </externalOrderReference>\n" +
    " <orderSalesReference>\n" +
    " <dealerReferenceID>D3641</dealerReferenceID>\n" +
    " <trailingCommissionRatePlan>MUPR9</trailingCommissionRatePlan>\n" +
    " <trailingCommisionDealerReference>D3734</trailingCommisionDealerReference>\n" +
    " </orderSalesReference>\n" +
    " </CustomerOrder>\n" +
    " <ContactManagementActivity>\n" +
    " <activityCategory>Proof of Purchase - Mig from 3</activityCategory>\n" +
    " <activityType>Migration from 3</activityType>\n" +
    " <activityDescription>Proof of Purchase Information</activityDescription>\n" +
    " <activityComment>MSISDN: 0425265789354610026170561</activityComment>\n" +
    " </ContactManagementActivity>\n" +
    "</migrateOrder>\n");
    NameValuePair[] nvpout = { nvpRtn };
    HttpConnection httpConn = new HttpConnection("172.22.161.101", 8017);
    System.out.println("httpConn : " + httpConn.getHost() + " getPost: " + httpConn.getPort());
    httpConn.open();
    System.out.println("Is Connection Open? --> " + httpConn.isOpen());
    PostMethod postMethod = new PostMethod();
    postMethod.setPath("http://172.22.161.101:8017/app/mig3/migrate/MigrateOrder");
    System.out.println("postMethod.getPath() : " + postMethod.getPath());
    //postMethod.setQueryString("http://172.22.161.101:8017/app/mig3/migrate/MigrateOrder");
    //System.out.println("getQueryString : " + postMethod.getQueryString());
    //System.out.println("postMethod.getParams() : " + postMethod.getParams());
    postMethod.setRequestBody(nvpout);
    System.out.println("validate--> " + postMethod.validate());
    postMethod.execute(new HttpState(), httpConn);
    System.out.println("isRequestSent --> " + postMethod.isRequestSent());
    System.out.println("statusLine--> " + postMethod.getStatusLine());
    String serviceResponse = postMethod.getResponseBodyAsString();
    System.out.println("Response from Call : " + serviceResponse);
    } catch (Exception e) {
    out.println("Error Occured during the process.");
    e.printStackTrace();
    ==========================================================================================
    Code 2 Response -----
    C:\Oracle\Middleware\SOASuite101351\jdk\bin\javaw.exe -jar C:\jdevstudio10135\j2ee\home\admin.jar ormi://10.161.1.169:23891 oc4jadmin **** -updateConfig
    11/03/02 15:30:19 WARNING: Shared-library oracle.expression-evaluator:10.1.3.1 is closing, but is imported by adf.oracle.domain:10.1.3.1, adf.generic.domain:10.1.3.1.
    2/03/2011 15:30:19 com.oracle.corba.ee.impl.orb.ORBServerExtensionProviderImpl preInitApplicationServer
    WARNING: ORB ignoring configuration changes. Restart OC4J to apply new ORB configuration.
    Ready message received from Oc4jNotifier.
    Embedded OC4J startup time: 7765 ms.
    Target URL -- http://10.161.1.169:8988/JAVAProject-RetriggerPSFTOrder-context-root/giftprocess
    ERROR: Unable to connect to JQS service: connection refused
    11/03/02 15:30:22 httpConn : 172.22.161.101 getPost: 8017
    11/03/02 15:30:22 Is Connection Open? --> true
    11/03/02 15:30:22 postMethod.getPath() : http://172.22.161.101:8017/app/mig3/migrate/MigrateOrder
    11/03/02 15:30:22 validate--> true
    11/03/02 15:30:22 isRequestSent --> true
    11/03/02 15:30:22 statusLine--> HTTP/1.1 200 OK
    2/03/2011 15:30:22 org.apache.commons.httpclient.HttpConnection releaseConnection
    WARNING: HttpConnectionManager is null. Connection cannot be released.
    11/03/02 15:30:22 Response from Call : <?xml version="1.0" encoding="UTF-8"?>
    <migrateOrderReply><statusCode>Failed</statusCode><errorReturn><errorCode>CORE_SYS_GENERIC</errorCode><errorMessage>Unexpected System exception</errorMessage></errorReturn></migrateOrderReply>
    ==================================================================================
    If u find any thing wrong then please let me know.
    Any reply is highly appreciated.
    Thanks Manish

  • Stub for web service in JSP

    How do i embed a scriptlet inside my JSP page for the stub of my web service? is there any examples that i can refer to?
    Thanks in advance. ;)

    Check out the 2 How To:
    9.0.4 / 10.1.2 "How to use OC4J JSP Tags for Web Services" [1].
    10.1.3 (preview) "Access J2EE 1.4 JAX-RPC Java Web Services from Web Clients" [2].
    Hope this helps,
    Eric
    [1] http://www.oracle.com/technology/sample_code/tech/java/codesnippet/webservices/wstags/index.html
    [2] http://www.oracle.com/technology/products/jdev/101/howtos/jaxrpc/java14_ws_web_clients.html

  • About XML Parameter for Web Service invoking

    I would like to use the XML parameter as the Web Service's input(Attachment is
    the XML schema) in WebLogic Server 8 sp1. When I generated the Web Service and
    use the WebLogic Server generate test web page to test it, I got Exception. The
    WebLogic Server can't constructe the input XML.
    The correct XML should look like this:
    <ids>
    <desc>Description</desc>
    <id>1</id>
    <id>2</id>
    <id>3</id>
    </ids>
    Is there any one can tell me whether this kind of XML was permitted for Web Service
    invoking or not?
    [sample.xsd]

    Hi Andy,
    On the test page, before the invoke of the operation, did it say
    something like:
    <!-- Do not know how to create a sample instance for this part due to
    the following exception:java.lang.InstantiationException:
    javax.xml.soap.SOAPElement. Pls replace this with the correct XML before
    invoking the service. --->
    if so, the service itself may be working OK, the deficiency is that the
    test page tries its best to determine sample values for the invoke,
    however it does not know in this case.
    Did you try with a client?
    Your XML should be fine.
    Regards,
    Bruce
    Andy wrote:
    >
    I would like to use the XML parameter as the Web Service's input(Attachment is
    the XML schema) in WebLogic Server 8 sp1. When I generated the Web Service and
    use the WebLogic Server generate test web page to test it, I got Exception. The
    WebLogic Server can't constructe the input XML.
    The correct XML should look like this:
    <ids>
    <desc>Description</desc>
    <id>1</id>
    <id>2</id>
    <id>3</id>
    </ids>
    Is there any one can tell me whether this kind of XML was permitted for Web Service
    invoking or not?
    Name: sample.xsd
    sample.xsd Type: ACT Project (text/xml)
    Encoding: base64

  • Could not generate stub objects for web service invocation in ColdFusion

    I was able to call the services on the development box - windows server without any problem at all, everything was working fine but the moment i uploaded to a linux box production server I get this error. "Could not generate stub objects for web service invocation in ColdFusion"
    What could be the cause of this problem, i have googled a lot but no solution yet any ideas.

    Let me make it simple:
    1. Server A is our development server.- hosted inhouse with coldfusion installed.
    2. Server B is our production server - a linux server with coldfusion installed hosted on the internet
    3. Server C is a third party server containing the webservice - this is a windows server with .net
    coldfusion is installed on Server A, the code works here and can connect to server C without any problem. It gets the required respone
    but when the code was uploaded to server c it gives the error when we run it.
    now i tried just a simple code which works fine on server A below:
    <cfinvoke webservice="http://www.webservicex.net/CurrencyConvertor.asmx?WSDL" method="ConversionRate" returnvariable="ConversionRateResult">
        <cfinvokeargument name="FromCurrency" value="EUR" />
        <cfinvokeargument name="ToCurrency" value="USD" />
    </cfinvoke>
    <cfdump var="#ConversionRateResult#" />
    But when i uploaded it to server C: it returns the error
    Cannot generate stub objects for web service invocation.
    Name: http://www.webservicex.net/CurrencyConvertor.asmx?WSDL. WSDL: http://www.webservicex.net/CurrencyConvertor.asmx?WSDL. java.io.FileNotFoundException: /opt/coldfusion8/stubs/WS728929035/NET/webserviceX/www/Currency.java (No such file or directory) It is recommended that you use a web browser to retrieve and examine the requested WSDL document to ensure it is correct. If the requested WSDL document cannot be retrieved or is dynamically generated, it is likely that the target web service has programming errors.
    The error occurred in /home/works/public_html/currency.cfm: line 7
    5 :     <cfinvokeargument name="FromCurrency" value="EUR" />
    6 :
    7 :     <cfinvokeargument name="ToCurrency" value="USD" />
    8 :
    9 : </cfinvoke>
    Now if you try the preceeding code on a windows environment  it works fine but the moment you put in the in the linux environment it generates this error
    I feel that the error may actually be :
    java.io.FileNotFoundException: /opt/coldfusion8/stubs/WS728929035/NET/webserviceX/www/Currency.java (No such file or directory)
    but i am clueless as to what to do next
    Ok so I tried the wget command on the linux
    this is what i got
    -bash-3.2# wget http://www.webservicesx.net/CurrencyConvertor.asmx?WDSL
    --2011-07-02 23:23:42--  http://www.webservicesx.net/CurrencyConvertor.asmx?WDSL
    Resolving www.webservicesx.net... 216.8.179.25
    Connecting to www.webservicesx.net|216.8.179.25|:80... connected.
    HTTP request sent, awaiting response... 403 Forbidden
    2011-07-02 23:23:43 ERROR 403: Forbidden.

  • XI for Web Services

    Hi experts,
    I want some guidance on the following:-
    1) How can we implement XI with SAP SCEM(Supply Chain Event Management) and SAP Internet sales.
    2)our client wants to get SAP XI involved for Web services. He wants that his customers should be able to access data through web portal . the data can be dynamic or static . How to go about it?
    3)How XI can be integrated with SAP mobile applications?
    Regards
    Saras Jain

    Hi,
    <i>1) How can we implement XI with SAP SCEM(Supply Chain Event Management) and SAP Internet sales.</i>
    You can use SAP XI contents for SAP SCEM in which you will find almost all the interfaces for implementing the integration of SCEM.
    <i>2)our client wants to get SAP XI involved for Web services. He wants that his customers should be able to access data through web portal . the data can be dynamic or static . How to go about it?</i>
    Yes, you can use SAP XI as a middleware to expose SAP functionality as a webservice. For more details about the SCEM contents and how Enterprise service works refer to the below link
    https://www.sdn.sap.com/irj/sdn/explore-es
    <i>3)How XI can be integrated with SAP mobile applications?</i>
    SAP XI is a middleware so it provides the integration for any of the platform it could be SAP MAP or it could be RFID or any other third party tool
    Regard
    Sumit Bhutani

  • Looking for Web Services Toolkits

    I'm completely new to Web Services and I need to build client applications for some existing web services and I have some questions:
    1) I have heard that things called "toolkits" are what I need to create and run client applications for web services. Is this correct?
    2) Can anyone tell me some of the more common and reliable toolkits?
    Thanks.

    EasyWebservice at http://www.acelet.com/super/SuperWebservice/index.html
    You can get all available services from WSDL and invoke them by clicking on Swing windows. You can export them and schedule the task using SuperScheduler at http://www.acelet.com/super/SuperScheduler/index.html or SuperWatchdog at http://www.acelet.com/super/SuperWatchdog/index.html.
    The standard perpetual license is free.

  • Re: Why doesn't WL7.0 support get/post bindings for web services ...

    hi!!!
    Could you pls point to any code example.
    thanks
    Pushpa
    "Richard Berger" <[email protected]> wrote:
    >
    Manoj: Thanks for the answer - do you have or can you point me at any
    code samples
    that accomplish this? (Yes, .NET is limited to strings/ints in their
    get/post
    bindings).
    Thanks so much!
    RB
    PS - Also, can you explain any apparent discrepancy between your answer
    and what
    the WL documentation stated (again, it may be my misunderstanding).
    "manoj cheenath" <[email protected]> wrote:
    WL 7.0 does allow you to access the web service through
    the browser. It even allows you to invoke service methods
    with complex type arguments (.Net only supports primitive
    types) and also to view the request and response soap
    message for the invocation.
    regards,
    -manoj
    "Richard Berger" <[email protected]> wrote in message
    news:[email protected]...
    This might be a naive question, but according to the documentation,WL 7.0
    does
    not support http post/get bindings for web services. Thus, for meto
    access a
    web service, I need to write a "middle tier" of some sort (I used
    the
    automatically
    generated Java proxy code and JSP). All works fine, but it seems
    like
    it
    would
    sure be nice to have HTML forms access web services without havingto
    write a
    middle tier.
    NET does this and it is extremely useful - is there a reason that
    BEA
    chose not
    to provide this feature? (e.g. is it architecturally unsound in anyway?
    or is
    there an easy way to simulate it?). Given some of the Web Workshoppositioning
    re: ease of use and .NET comparison, this seems like an omission.
    Any insights are greatly appreciated.
    Enjoy,
    RB
    PS - Here's the info from the documentation
    Web Services Description Language (WSDL) 1.1 Specification
    WSDL is an XML-based language that describes Web services. WSDL definesWeb services
    as a set of endpoints operating on messages; these message containeither
    message-style
    or RPC-style information. The operations and messages are describedabstractly
    in WSDL, and then bound to a concrete network protocol and messageformat
    to define
    an endpoint. Related concrete endpoints are combined into abstractendpoints (services).
    WSDL is extensible to allow the description of endpoints and theirassociated
    messages regardless of what message formats or network protocols areused
    to communicate,
    however, the only bindings described in the specification describehow to
    use
    WSDL in conjunction with SOAP 1.1, HTTP GET/POST, and MIME.
    Note: WebLogic Server supports only SOAP 1.1 bindings.
    The WSDL 1.1 Specification is available at http://www.w3.org/TR/wsdl.

    This isn't a straight FORM Post as in the http binding support in WSDL. It posts
    a soap message.
    It's apparent that Workshop supports form-post and form-get.
    But I dont see how it is done with straight WebLogic webservices. Does WebLogic
    server read the web-services.xml or the WSDL file? I dont see a way to put in
    http-post binding in the former and in the latter it seems to be ignored.
    Can someone clarify.
    Thanks.
    Chu-chi
    "manoj cheenath" <[email protected]> wrote:
    Here is a live example:
    http://65.193.192.35:7001/base/SoapInteropBaseService
    Here is an example that you can download:
    http://manojc.com/?sample2
    This is how you run it:
    http://manojc.com/?tutorial/doc/howtorun.html
    More info can be found from the edocs:
    7.0:
    http://edocs.bea.com/wls/docs70/webserv/index.html
    8.1:
    http://edocs.bea.com/wls/docs81/webserv/index.html
    Regards,
    -manoj
    http://manojc.com
    "pushpa krishna" <[email protected]> wrote in message
    news:[email protected]...
    hi!!!
    Could you pls point to any code example.
    thanks
    Pushpa
    "Richard Berger" <[email protected]> wrote:
    Manoj: Thanks for the answer - do you have or can you point me at
    any
    code samples
    that accomplish this? (Yes, .NET is limited to strings/ints in their
    get/post
    bindings).
    Thanks so much!
    RB
    PS - Also, can you explain any apparent discrepancy between your answer
    and what
    the WL documentation stated (again, it may be my misunderstanding).
    "manoj cheenath" <[email protected]> wrote:
    WL 7.0 does allow you to access the web service through
    the browser. It even allows you to invoke service methods
    with complex type arguments (.Net only supports primitive
    types) and also to view the request and response soap
    message for the invocation.
    regards,
    -manoj
    "Richard Berger" <[email protected]> wrote in message
    news:[email protected]...
    This might be a naive question, but according to the documentation,WL 7.0
    does
    not support http post/get bindings for web services. Thus, for
    me
    to
    access a
    web service, I need to write a "middle tier" of some sort (I used
    the
    automatically
    generated Java proxy code and JSP). All works fine, but it seems
    like
    it
    would
    sure be nice to have HTML forms access web services without havingto
    write a
    middle tier.
    NET does this and it is extremely useful - is there a reason that
    BEA
    chose not
    to provide this feature? (e.g. is it architecturally unsound in
    any
    way?
    or is
    there an easy way to simulate it?). Given some of the Web Workshoppositioning
    re: ease of use and .NET comparison, this seems like an omission.
    Any insights are greatly appreciated.
    Enjoy,
    RB
    PS - Here's the info from the documentation
    Web Services Description Language (WSDL) 1.1 Specification
    WSDL is an XML-based language that describes Web services. WSDL
    defines
    Web services
    as a set of endpoints operating on messages; these message containeither
    message-style
    or RPC-style information. The operations and messages are describedabstractly
    in WSDL, and then bound to a concrete network protocol and messageformat
    to define
    an endpoint. Related concrete endpoints are combined into abstractendpoints (services).
    WSDL is extensible to allow the description of endpoints and theirassociated
    messages regardless of what message formats or network protocols
    are
    used
    to communicate,
    however, the only bindings described in the specification describehow to
    use
    WSDL in conjunction with SOAP 1.1, HTTP GET/POST, and MIME.
    Note: WebLogic Server supports only SOAP 1.1 bindings.
    The WSDL 1.1 Specification is available at http://www.w3.org/TR/wsdl.

Maybe you are looking for