Java Web Service Access SOP Header and SOAP Body

Hi
I am newbie to Web Service. I had a Java class and I converted it to Web Service(LoginWebService has methods login, register).
Now my client is accessing my web services and calling methods login and register.
Now I want to add few values in SOAP header in client side.
My Questions:
1. How can I access the SOAP headers and SOAP Body in my Server Web Service method implementations?
2. Is there any API that I have to use?
3. Does anyone have any sample code for these things?
Thanks

Seems like the exception handling logic is not sound - but your posting is difficult to read. Please use the *\* tag to mark and end source code snippets.
Have a look at the sample code in {message:id=4205205} - does a SOAP call using PL/SQL only.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Similar Messages

  • Java Web Service "clears" sop:Include/ from SOAP Body?

    I have a Java Web Service which processes SOAP Messages with MIME attachments. The references to the attachments are using XOP (XML-binary Optimized Packaging) specification.
    The XML Schema for the SOAP Body content imports the namespace "http://www.w3.org/2004/08/xop/include", but it is not its main target namespace. When I run the service and view the HTTP packet through HTTP Analyzer, the SOAP Envelope looks like this:
    <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"
                  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xmlns:ns0="http://www.ACORD.org/Standards/AcordMsgSvc/1"
                  xmlns:xop="http://www.w3.org/2004/08/xop/include"
                  xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
        <env:Header>
        </env:Header>
        <env:Body>
            <ac:CallRq xmlns:ac="http://www.ACORD.org/Standards/AcordMsgSvc/1">
                <ac:WorkFolder>
                    <ac:MsgFile>
                        <ac:FileId>
    <sop:Include href="cid:93609df7-d718-4801-bab9-57e3fd9cc5b5"
    xmlns:sop="http://www.w3.org/2004/08/xop/include"
    xsi:schemaLocation="http://www.w3.org/2004/08/xop/include http://www.w3.org/2004/08/xop/include"/>
    </ac:FileId>
                        <ac:FileFormatCd>text/xml</ac:FileFormatCd>
                    </ac:MsgFile>
                </ac:WorkFolder>
            </ac:CallRq>
        </env:Body>
    </env:Envelope>But when I access the java.xml.soap.SOAPMessage object in handleRequest(MessageContext) method of the Web Service's handler I get the following:
    <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"
                  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xmlns:ns0="http://www.ACORD.org/Standards/AcordMsgSvc/1"
                  xmlns:xop="http://www.w3.org/2004/08/xop/include"
                  xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
        <env:Header>
        </env:Header>
        <env:Body>
            <ac:CallRq xmlns:ac="http://www.ACORD.org/Standards/AcordMsgSvc/1">
                <ac:WorkFolder>
                    <ac:MsgFile>
                        <ac:FileId>
    </ac:FileId>
                        <ac:FileFormatCd>text/xml</ac:FileFormatCd>
                    </ac:MsgFile>
                </ac:WorkFolder>
            </ac:CallRq>
        </env:Body>
    </env:Envelope>As you can see, the <sop:Include/> element has disappeared.
    Does anyone has an idea why this happens?
    Thank you!
    Simeon

    Neither the simple "setter" methods work.. :(
    The php client side:
    $string="aladar";
    $client->setSample($string);
    $return = $client->getSample();
    The server side:
    public String sample;
    public String getSample() {
    return sample;
    public void setSample(String a_sample) {
    sample = a_sample;
    Any ideas?

  • Java Web Services accessing rmi server

    Hi,
    I want to access the rmi server from a java web services.My java web services is running under Sun application server9.The rmi server is not using any application server.Please help me to sort out the problem.
    Bye
    Binay

    What's the problem exactly? I assume you understand that the RMI server has to run like any RMI server, it has to bind itself into a Registry; the Web server acts as an RMI client so it has to look up the Registry to get a remote reference so it can call the required remote methods.

  • OTN Live Web Services problem, mismatched WSDLs and Soap RPC reply

    I've tried to connect to all those OTN Live Web Services using webMethods and found there might be a mismatched WSDLs and Soap RPC problem in Oracle side. There is a discussion thread of this: http://www.wmusers.com/wmusers/messages/116/904.shtml
    Is there anyone out there encounters the same problem and agree that Oracle should fix this ? Thanks a lot in advance.

    Hi Mike,
    I've just downloads all 5 WSDL and tried each single one of them again. The following are the results of the test.
    Result (OK): this is the success case
    Result (0): this is the "OTN Authentication Failure" and I cannot tell if it works if input is correct.
    Result (1): this is the error I've mentioned in the previous message and I'll give you more details later.
    Result (2): this is the "No Serializer found" exception:
    java.lang.IllegalArgumentException: No Serializer found to serialize a
    'org.w3c.dom.Element' using encoding style 'http://schemas.xmlsoap.org/soap/encoding/'.
    -- IOTNMobileWrapperPortType
    getStatusByMsgID (OTN Authentication Failure)
    getStatusesByMsgIDs (1)
    getSupportedTransports (1)
    getVersion (1)
    sendText (1)
    sendTextMsg (1)
    -- OTNDeptEmpPortType
    getDeptInfoArray (OK)
    getDeptInfoXML (2)
    getDeptNoArray (OK)
    getDeptXML (2)
    getEmpInfoArray (OK)
    getEmpInfoXML (2)
    getEmpNoArray (OK)
    getEmpXML (2)
    -- IOTNGUIDGeneratorPortType
    getGUID (1)
    -- IOTNHelloWorldPortType
    getAvailableLanguages (1)
    getDefaultHelloWorld (1)
    getHelloWorld (1)
    -- IOTNNewsPortType
    getRss (1)
    Let me explain what happens in error case (1):
    webMethods construct the "targetOutSignature" for the client base on the WSDL.
    After the reply message retrieved, it tries to "conform" (validate) it against the "targetOutSignature".
    Whenever I get this exception, I can open the exception details and actually see that the reply xml has been received but with the error message of "Output parameters do not conform to targetOutputSignature".
    If I manually remove the "targetOutputSignature" from the generated client, so that webMethods won't try to "conform" the reply message against the one described in the original WSDL, it works perfectly.
    I hope this helps. Please let me know if there is any other information I can provide.
    Thanks.
    - Louis

  • Java Web Services

    Hi
    I have using jdevleper 10.1.2. I have generated a WebService for my Login Java class. The Web Service has 2 method login and register.
    I have converted the Java into a Web Service.
    I have created stub and I am able to call these Web Service methods.
    Now from the Client Stub I want to add some AOP headers. I want to retrieve these SOAP header in the Web Service methods.
    Can someone help me how can i access SOP headers and SOAP body in the implementation method.
    Thanks

    Google SCDJWS or so.

  • Java Web Services Developer Pack 1.5 and SOAP?

    Hi all,
    I'm trying to figure out what, if any, support does Java Web Services Developer Pack 1.5 have for parsing and dealing with SOAP messages. I couldn't find any documentation or info in the tutorial about it, but founds some packages through JavaDoc that seem to deal with SOAP. Does anyone know what the deal is? Do you use this toolkit for SOAP, maybe even WS-security?
    Thanks for any pointers!
    Olia

    You can use JWSDP 1.3 but the minimum requirement form that toolkit is JDK 1.4. So you need to download the JDK 1.4 from http:/java.sun.com and install it first and after that you can install that JWSDP 1.3. Good Luck.

  • (261680070) Q SYNCH-11 How do my web service methods accees EJBs and java classes?

    A<SYNCH-11> How do my web service methods accees EJBs and java classes?
    A<SYNCH-11> It is simple to use java classes, just do it as you would ordinarily.
    The .jws file really contains a simple class so you can program with it in the same
    way that you would use a regular Java class.
    To use an EJB you can go and access it directly as you would with any EJB remote
    client (lookup home stub, create, etc) or if the EJB is deployed to WLS you can use
    a control to provide a very simple wrapper to the EJB. We will see this in detail
    on Thursday in the ADVC module.

    Futher information about the possibility of callback:
    It may be possible for a synchronous only web service (i.e. MS .net) to even paticipant
    in the callback functionality of asynchronous web services. If the client implements
    the appropriate methods for the callback but listens for them on a different port
    or binding than the SOAP request, then web service may be able to build a response
    if the client's "callback URL" is submitted as the beginning part of a conversation.
    Watch the BEA developer forum (http://dev2dev.bea.com) for more information about
    this approach and other tips and techniques for building web services.
    "Adam FitzGerald" <[email protected]> wrote:
    >
    Q<SYNCH-03> I heard that MS .net only implements synchrnonus method? If
    this is true.
    Does it means my async methods will only work with J2EE clients?
    A<SYNCH-03> I do not know the limitations of .net but let me point out that
    is very
    difficult to provide asynchronous web service method invocation (this is
    different
    from an asynchronous web service). HTTP as a general communication protocol
    is based
    on a request and response paradigm so your client libraries will mostly
    likely be
    expecting a response even if it is empty (check the asynchronous example
    from today
    to see that the start method still returns an empty response). You must
    distinguish
    this from the notion of an asynchronous web service which is a business
    operation
    that occurs on the server whose return value/result is not directly associated
    with
    building response to the client. An asynchronous web service can (and generally
    will)
    be started and stopped with web service operations that are invoked synchronously.
    Thus MS .net clients can still be client to WLS hosted web services.

  • Java Web Services Developer Pack 1.3 and JDK 1.3.1

    Does anyone know if I can use Java Web Services Developer Pack 1.3 with JDK 1.3.1? The installation instructions only mention JDK 1.4.
    Thanks,
    Jerry

    You can use JWSDP 1.3 but the minimum requirement form that toolkit is JDK 1.4. So you need to download the JDK 1.4 from http:/java.sun.com and install it first and after that you can install that JWSDP 1.3. Good Luck.

  • Java Web Services wrapper and connection management.

    We are currently evaluating the use of the SES Java web-services for a custom front end. I've downloaded the sample code and have read through the documentation but I'm confused on a few points.
    We will be OSSO protecting the app, so the flow I think I need to use is (on the OracleSearchService object):
    *setSoapURL
    *proxyLogin
    *setSearchUser
    *doOracleSearch
    (do whatever with results)
    From what I can tell each one of these does a separate call into the actual web service. Does this keep a connection open between these calls and if so how do we need to manage our connections in this case. Is there an explicit close method we should be calling? I see that we can get an OracleSoapHTTPConnection from the undocumented getConnection method on OracleSearchService but I'm unsure if we are supposed to interact with it directly.
    In a related vein how should we managing our OracleSearchService objects? Should we save an instance for each user in our httpSession, or just create a new instance on each call?
    Any insights appreciated,
    Jason

    No Problem at all
    Nomally the Web Service is big different between Web application. or you can build your Web service structure like web application structure. It depends on the web server:
    If the Web Server of hosting company has WEB Service framework, you just need know how to deploy your Web service to Web Service framework and How to deploy to Web Server. In this case, you need deploy it two time, one is for Web Server framework and one is for Web Service framework
    If the Web Server of hosting company doesn't has WEB Service framework, you need build your own Web Service framework into a web application, then you just need know how to deploy your web application with Web service into Web Server framework

  • Java web service with php SOAP client

    Hi!
    I have a Java web service with a procedure, which connects to a database:
    public boolean connectDB(String driver,String host, String user, String password)
    try {
    Class.forName(driver);
    connection =
    DriverManager.getConnection
    host
    , user
    , password
    return true;
    } catch (Exception v_exception) {
    System.out.println("connectDB(): " + v_exception);
    return false;
    If I call it from a PHP client, it doesn't work but doesn't throw any exceptions on the server side.
    The way I call it:
    $client = new SoapClient
    (<path>);
    try
    $conn=$client->connectDB();
    catch (SoapFault $exception)
    echo "\nexception: " .$exception;
    On the client side, I have an exception, but it's not very detailed:
    exception: Object id #2
    I had a simple function, too, which returns a string:
    public String getTestString()
    return "test";
    and if I call it from PHP, it's working...
    What may be the problem?

    Neither the simple "setter" methods work.. :(
    The php client side:
    $string="aladar";
    $client->setSample($string);
    $return = $client->getSample();
    The server side:
    public String sample;
    public String getSample() {
    return sample;
    public void setSample(String a_sample) {
    sample = a_sample;
    Any ideas?

  • How to deploy and debug java web service in eclipes or using any other soft

    Hai,
    can any one tell me how to deploy and debug java web service in eclipes or using any other software.
    i have used tomcat web server and jdk1.4.0 to develop web service.
    we have used web service to interact with MS outlook .
    bye
    sudhakar.m

    Hi Sudhakar,
    If you are used to working with ant then you can very well use eclipse to deploy your web service.
    You would usually have the ant script in the source root working directory. From eclipse if you select the build file from the navigator view and right click you will see a run ant option in the pop up menu.
    Select that option and you would be able to see each targets with a checkbox select option. So define each target maybe one for wsdl2java conversion, one for compilation and one for deploying your web services. You can either make all of them run by having depends option on or you can run them individually as it takes your fancy.
    I am not sure about debugging a web service yet.
    Hope this helps
    Aviroop
    The truth is out there? Does anyone know the URL?

  • How to test a Java Web Service locally?

    I developed simple java web services.
    Now I want to test them locally.
    I want to expose my web service through my Web Server(Tomcat).
    How can I expose that webservice?
    After that I want to access my web service through a Internet Browser.
    Is it possible to test that web service locally (localhost)?
    My computer is not connected to a network or internet.
    My OS is Windows XP Professional.

    I just set up TCPMON. Considering it is free and the fact that it has more than just a basic UI, I am quite impressed. I also use SOAPscope, which is another great tool, but I am looking for a free option.
    My issue: I set up TCPMON to sniff messages sent over HTTPS through port 8080. But I am getting encrypted messages upon sending the SOAP request as follows:
    �b�b�b�bvC�Ym�)f��OvC�Ym�)f��W�O�k�v�W&#65533;�dQ�$�{� �4�����F&#65533;������vO���XEC
    )��~9gl^�OvC�Ym�)f��W�O�k�v�W&#65533;�dQ�$�{� �4�����F&#65533;������vO���XEC
    )��~9gl^�OvC�Ym�)f��W�O�k�v�W&#65533;�dQ�$�{� �4�����F&#65533;������vO���XEC
    )��~9gl^�
    Any clue why?
    Your help is greatly appreciated.
    Aish

  • The Best Java Web Services Technology for Developing Web Services

    Hi,
    I am new to Web services world.
    I read the java web services page . there are more than 6 technologies.
    JAX-WS,
    JAX-RPC,
    JAXB,
    SAAJ,
    JAXP,
    WSIT,
    XWS-Security
    I went through several documents on web services.
    I could not get a clear idea of which technolgy to use.
    Which Java web service technology will be the best to develop web services independant of language, platform.
    or is there any 3rd party implemetations available ? for rapid development of web services.
    Could anyone help me !.
    Thanks in advance.
    Message was edited by:
    Siva.Prakash

    Which Java web service technology will be the best
    to develop web services independant of language,
    platform.
    Java by nature is a cross-platform language, so if your focus is on the need for portability, the choisce of WS should not be a problem. However, each WS is best suited for paricular uses.
    SAAJ, a low-level level API, offers much simplicity, but is not the first choice for programmers, as SOAP (Simple Object Access Protocol)messages need to be constructed piece by piece, making it a quite arduous code to program.
    If you are not familiar with XML, your best bet would be to use JAX-RPC (Java API for XML-Remote Procedure Calls), as it hides the underlying detail from the programmer, in terms of SOAP and XML. The shortcoming with RPC-based WS is that it is "restricted to the local programming experience". Another failing is that assumes there is a network path- a reliability concern.
    If your program will be contacting other services during downtimes, unlike JAX-RPC, JAXM is quite useful. However, your listing did not mention it, so I wont cover it.
    JAXR is a client-side only API that acts as an interface between registries (not referring to JAXP)
    I am not famiiar with JAXB, JAXP, WSIT or XWS-Security..
    or is there any 3rd party implemetations available ?It depends on what platform you are used to. Assuming you are familiarized with the J2EE platform (now changed to Java EE SDK), the NetBeans IDE (either 5.5, 5.5.1 or the latest editiion) is quite useful. I am using 5.5.1, but have found that it is quite buggy, especially when adding WS operations, a core requirement of a WS. if you will be using to devlop a service for an immediate need, you may find the learning curve to be a bit high, in terms of getting to grips with how to use it. (Download link:
    http://www.netbeans.info/downloads/index.php)
    The IBM Autonomic IDE (or AIDE), based on the WSDM standard, includes 3 sub-tools, icluding the IBM Manageability Endpoint Builder which, according to their website, allows individuals to build endpoints to allow manageability interface exposure; Manageable Resource Browser and the IBM Manageability Endpoint Simulator. However, I'm not familiar with this IDE. (Download link: http://www.alphaworks.ibm.com/tech/aide/download)
    The .NET Framework uses the Visual Studio IDE. For an unbiased comparison of J2EE and the .NET Framework in terms of WS, see http://www.webservicesarchitect.com/content/articles/hanson01.asp.
    Apache Axis2, Geronimo and JiBX allows fast development of WS, or so the creators profess.
    The PHP environment- you could try NuSPHERE PHPed. According to one website, with it you can develop a web service in under an hour.
    I hope this was useful to you.
    [Based partly on Topley, K. (2003) [i]Java TM Web Services in a Nutshell: A desktop Quick Reference. 1st ed. California: O�Reilly & Associates, Inc]

  • Call thirty party java web service but always return null

    hi
    I call a java web service in my application visual studio 2008 c#, but always return NULL.
    I used Tool Fiddler to monitor the traffic between my client and the web service server, it showed the return is not Null.
    Here is my code, please see if anything I do wrong.
    namespace CanOfficer_THQ_vs_IHQ.TestWebReferenceAppointment {
    using System.Diagnostics;
    using System.Web.Services;
    using System.ComponentModel;
    using System.Web.Services.Protocols;
    using System;
    using System.Xml.Serialization;
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.5483")]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    [System.Web.Services.WebServiceBindingAttribute(Name="AppointmentServiceSoapBinding", Namespace="http://service.ips.salvationarmy.org/")]
    public partial class AppointmentService : Microsoft.Web.Services3.WebServicesClientProtocol {
    private System.Threading.SendOrPostCallback deleteAppOperationCompleted;
    private System.Threading.SendOrPostCallback importAppOperationCompleted;
    private System.Threading.SendOrPostCallback editAppOperationCompleted;
    private bool useDefaultCredentialsSetExplicitly;
    /// <remarks/>
    public AppointmentService() {
    this.Url = global::CanOfficer_THQ_vs_IHQ.Properties.Settings.Default.CanOfficer_THQ_vs_IHQ_TestWebReferenceAppointment_AppointmentService;
    if ((this.IsLocalFileSystemWebService(this.Url) == true)) {
    this.UseDefaultCredentials = true;
    this.useDefaultCredentialsSetExplicitly = false;
    else {
    this.useDefaultCredentialsSetExplicitly = true;
    public new string Url {
    get {
    return base.Url;
    set {
    if ((((this.IsLocalFileSystemWebService(base.Url) == true)
    && (this.useDefaultCredentialsSetExplicitly == false))
    && (this.IsLocalFileSystemWebService(value) == false))) {
    base.UseDefaultCredentials = false;
    base.Url = value;
    public new bool UseDefaultCredentials {
    get {
    return base.UseDefaultCredentials;
    set {
    base.UseDefaultCredentials = value;
    this.useDefaultCredentialsSetExplicitly = true;
    /// <remarks/>
    public event deleteAppCompletedEventHandler deleteAppCompleted;
    /// <remarks/>
    public event importAppCompletedEventHandler importAppCompleted;
    /// <remarks/>
    public event editAppCompletedEventHandler editAppCompleted;
    /// <remarks/>
    [System.Web.Services.Protocols.SoapDocumentMethodAttribute(
    RequestNamespace="http://service.ips.salvationarmy.org/",
    ResponseNamespace="http://service.ips.salvationarmy.org/",
    Use=System.Web.Services.Description.SoapBindingUse.Encoded,
    ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
    [return: System.Xml.Serialization.XmlElementAttribute("return", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
    public string deleteApp([System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] int id) {
    object[] results = this.Invoke("deleteApp", new object[] {
    id});
    return ((string)(results[0]));
    /// <remarks/>
    public void deleteAppAsync(int id) {
    this.deleteAppAsync(id, null);
    /// <remarks/>
    public void deleteAppAsync(int id, object userState) {
    if ((this.deleteAppOperationCompleted == null)) {
    this.deleteAppOperationCompleted = new System.Threading.SendOrPostCallback(this.OndeleteAppOperationCompleted);
    this.InvokeAsync("deleteApp", new object[] {
    id}, this.deleteAppOperationCompleted, userState);
    private void OndeleteAppOperationCompleted(object arg) {
    if ((this.deleteAppCompleted != null)) {
    System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
    this.deleteAppCompleted(this, new deleteAppCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
    /// <remarks/>
    [System.Web.Services.Protocols.SoapDocumentMethodAttribute(
    RequestNamespace="http://service.ips.salvationarmy.org/",
    ResponseNamespace="http://service.ips.salvationarmy.org/",
    Use=System.Web.Services.Description.SoapBindingUse.Encoded,
    ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
    [return: System.Xml.Serialization.XmlElementAttribute("return", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
    public string importApp(
    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] int person,
    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] string name,
    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] string territory,
    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] string location,
    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] bool primary,
    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] Nullable<System.DateTime> start,
    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] Nullable<System.DateTime> end,
    [System.Xml.Serialization.XmlElementAttribute("categories", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] string[] categories) {
    object[] results = this.Invoke("importApp", new object[] {
    person,
    name,
    territory,
    location,
    primary,
    start,
    end,
    categories});
    return ((string)(results[0]));
    /// <remarks/>
    public void importAppAsync(int person, string name, string territory, string location, bool primary, Nullable<System.DateTime> start, Nullable<System.DateTime> end, string[] categories) {
    this.importAppAsync(person, name, territory, location, primary, start, end, categories, null);
    /// <remarks/>
    public void importAppAsync(int person, string name, string territory, string location, bool primary, Nullable<System.DateTime> start, Nullable<System.DateTime> end, string[] categories, object userState) {
    if ((this.importAppOperationCompleted == null)) {
    this.importAppOperationCompleted = new System.Threading.SendOrPostCallback(this.OnimportAppOperationCompleted);
    this.InvokeAsync("importApp", new object[] {
    person,
    name,
    territory,
    location,
    primary,
    start,
    end,
    categories}, this.importAppOperationCompleted, userState);
    private void OnimportAppOperationCompleted(object arg) {
    if ((this.importAppCompleted != null)) {
    System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
    this.importAppCompleted(this, new importAppCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
    /// <remarks/>
    [System.Web.Services.Protocols.SoapDocumentMethodAttribute(
    RequestNamespace="http://service.ips.salvationarmy.org/",
    ResponseNamespace="http://service.ips.salvationarmy.org/",
    Use=System.Web.Services.Description.SoapBindingUse.Encoded,
    ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
    [return: System.Xml.Serialization.XmlElementAttribute("return", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
    public string editApp(
    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] int id,
    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] string name,
    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] string territory,
    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] string location,
    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] bool primary,
    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] Nullable<System.DateTime> start,
    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] Nullable<System.DateTime> end,
    [System.Xml.Serialization.XmlElementAttribute("categories", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] string[] categories) {
    object[] results = this.Invoke("editApp", new object[] {
    id,
    name,
    territory,
    location,
    primary,
    start,
    end,
    categories});
    return ((string)(results[0]));
    /// <remarks/>
    public void editAppAsync(int id, string name, string territory, string location, bool primary, Nullable<System.DateTime> start, Nullable<System.DateTime> end, string[] categories) {
    this.editAppAsync(id, name, territory, location, primary, start, end, categories, null);
    /// <remarks/>
    public void editAppAsync(int id, string name, string territory, string location, bool primary, Nullable<System.DateTime> start, Nullable<System.DateTime> end, string[] categories, object userState) {
    if ((this.editAppOperationCompleted == null)) {
    this.editAppOperationCompleted = new System.Threading.SendOrPostCallback(this.OneditAppOperationCompleted);
    this.InvokeAsync("editApp", new object[] {
    id,
    name,
    territory,
    location,
    primary,
    start,
    end,
    categories}, this.editAppOperationCompleted, userState);
    private void OneditAppOperationCompleted(object arg) {
    if ((this.editAppCompleted != null)) {
    System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
    this.editAppCompleted(this, new editAppCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
    /// <remarks/>
    public new void CancelAsync(object userState) {
    base.CancelAsync(userState);
    private bool IsLocalFileSystemWebService(string url) {
    if (((url == null)
    || (url == string.Empty))) {
    return false;
    System.Uri wsUri = new System.Uri(url);
    if (((wsUri.Port >= 1024)
    && (string.Compare(wsUri.Host, "localHost", System.StringComparison.OrdinalIgnoreCase) == 0))) {
    return true;
    return false;
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.5483")]
    public delegate void deleteAppCompletedEventHandler(object sender, deleteAppCompletedEventArgs e);
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.5483")]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    public partial class deleteAppCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
    private object[] results;
    internal deleteAppCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
    base(exception, cancelled, userState) {
    this.results = results;
    /// <remarks/>
    public string Result {
    get {
    this.RaiseExceptionIfNecessary();
    return ((string)(this.results[0]));
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.5483")]
    public delegate void importAppCompletedEventHandler(object sender, importAppCompletedEventArgs e);
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.5483")]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    public partial class importAppCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
    private object[] results;
    internal importAppCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
    base(exception, cancelled, userState) {
    this.results = results;
    /// <remarks/>
    public string Result {
    get {
    this.RaiseExceptionIfNecessary();
    return ((string)(this.results[0]));
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.5483")]
    public delegate void editAppCompletedEventHandler(object sender, editAppCompletedEventArgs e);
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.5483")]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    public partial class editAppCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
    private object[] results;
    internal editAppCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
    base(exception, cancelled, userState) {
    this.results = results;
    /// <remarks/>
    public string Result {
    get {
    this.RaiseExceptionIfNecessary();
    return ((string)(this.results[0]));

    Hi;
    I used Fiddler to monitor the process, and it showed the request sent thru web service worked and returned a value, but in my .Net application the return captured as NULL. Could you please look into the code above and the result from Filddler and see if
    you can help.
    thank you.
    REQUEST:
    POST https://159.253.140.178/services/AppointmentService HTTP/1.1
    User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 2.0.50727.4252)
    Content-Type: text/xml; charset=utf-8
    SOAPAction: ""
    Host: 159.253.140.178
    Content-Length: 1589
    Expect: 100-continue
    Connection: Keep-Alive
    <?xml version="1.0" encoding="utf-8"?>
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://service.ips.salvationarmy.org/" xmlns:types="http://service.ips.salvationarmy.org/encodedTypes" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">
    <soap:Header>
    <wsse:Security mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
    <wsse:UsernameToken xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
    <wsse:Username>
    [email protected]
    </wsse:Username>
    <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">
    tpi4IPSws!
    </wsse:Password>
    </wsse:UsernameToken>
    </wsse:Security>
    </soap:Header>
    <soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    <tns:importApp>
    <person xsi:type="xsd:int">
    169275
    </person>
    <name xsi:type="xsd:string">
    Corps Officer (Cahul-Russia) Test12
    </name>
    <territory xsi:type="xsd:string">
    CAN
    </territory>
    <location xsi:type="xsd:string">
    TEST LOCATION 12
    </location>
    <primary xsi:type="xsd:boolean">
    true
    </primary>
    <start xsi:type="xsd:dateTime">
    2013-05-30T00:00:00
    </start>
    <end xsi:type="xsd:dateTime">
    2014-06-04T00:00:00
    </end>
    <categories href="#id1" />
    </tns:importApp>
    <soapenc:Array id="id1" soapenc:arrayType="xsd:string[1]">
    <Item>
    vpsCat1
    </Item>
    </soapenc:Array>
    </soap:Body>
    </soap:Envelope>
    RESPONSE:
    HTTP/1.1 200 OK
    Server: Apache-Coyote/1.1
    Content-Type: text/xml;charset=UTF-8
    Content-Length: 232
    Date: Fri, 05 Sep 2014 19:45:22 GMT
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>
    <ns2:importAppResponse xmlns:ns2="http://service.ips.salvationarmy.org/">
    <return>
    OK_572463
    </return>
    </ns2:importAppResponse>
    </soap:Body>
    </soap:Envelope>

  • Generating Ruby Web Service Access Classes from a WSDL

    If you have tried to consume a web service from Ruby you surely have noticed how annoying is to write manually all the Ruby code just to invoke a service with complext input parameters' structure:
    - You have to know what do the input parameters, their structure and type look like;
    - You have to write Ruby classes for them to encapsulate the structures;
    - You have to instantiate these classes and pass the objects to the web service proxy class;
    - You have to interprete the output parameters.
    All this is not impossible of course, but if you are just consumer of the web service and not the developer, if you don't have the exact documentation, you have to read the WSDL description of the service and create the Ruby classes (structures) for the parameters.
    Fortunately there is a small, though handy tool, called <b>wsdl2ruby.rb</b>. It accomplishes all these boring tasks for you.
    In the following example I will try to show you how <b>wsdl2ruby</b> can be used to generate Ruby classes for accessing a SAP NetWeaver web service, called <b>CreditChecker1</b> (a web service for checking if a person is reliable credit consumer).
    To generate the necessary classes we will create a ruby script. Let us name it <b>ws2rgen.rb</b>. Here is what this file looks like:
    # Import the wsdl2ruby library.
    require 'wsdl/soap/wsdl2ruby'
    require 'logger'
    # Callback function for the WSDL 2 Ruby generation options.
    def getWsdlOpt(s)
         optcmd= {}
         s << "Service"
         optcmd['classdef'] = s
         #should work but doesn't, driver name is derived from classname
         #if you specify both it breaks, same thing for client_skelton
         #optcmd['driver'] = s
         optcmd['driver'] = nil
         #optcmd['client_skelton'] = nil
         optcmd['force'] = true
         return optcmd
    end
    # Create logger.
    logger = Logger.new(STDERR)
    # Create WSDL2Ruby object and generate.
    worker = WSDL::SOAP::WSDL2Ruby.new
    worker.logger = logger
    # WSDL file location.
    worker.location = "http://mysapserver:53000/CreditChecker1/Config1?wsdl"
    # Where to generate.
    worker.basedir = "temp"
    # Set options.
    worker.opt.update(getWsdlOpt("Service"))
    # Heat.
    worker.run
    The procedure is straightforward. First we create the WSDL2Ruby object, set its properties <b>location</b> and <b>basedir</b> and then set all other options via the callback function <b>getWsdlOpt()</b>. For further information about these parameters one could consult the source code of wsdl2ruby or contact the developers. Nevertheless the default options are pretty satisfactory. With the last line we start the generation. Two Ruby files will be generated in the <b>temp</b> folder, which is a subfolder of the script's current folder. <b>Please, create the folder "temp" before executing the script.</b>
    This generates two files. The first one is <b>CreditChecker1Wsd.rb</b>, containing the necessary data structures:
    require 'xsd/qname'
    # {urn:CreditChecker1Vi}areReliable
    class AreReliable
      @@schema_type = "areReliable"
      @@schema_ns = "urn:CreditChecker1Vi"
      @@schema_qualified = "true"
      @@schema_element = [["persons", "ArrayOfPerson"]]
      attr_accessor :persons
      def initialize(persons = nil)
        @persons = persons
      end
    end
    # {urn:CreditChecker1Vi}areReliableResponse
    class AreReliableResponse
      @@schema_type = "areReliableResponse"
      @@schema_ns = "urn:CreditChecker1Vi"
      @@schema_qualified = "true"
      @@schema_element = [["response", ["ArrayOfboolean", XSD::QName.new("urn:CreditChecker1Vi", "Response")]]]
      def Response
        @response
      end
      def Response=(value)
        @response = value
      end
      def initialize(response = nil)
        @response = response
      end
    end
    # {urn:CreditChecker1Vi}isReliable
    class IsReliable
      @@schema_type = "isReliable"
      @@schema_ns = "urn:CreditChecker1Vi"
      @@schema_qualified = "true"
      @@schema_element = [["person", "Person"]]
      attr_accessor :person
      def initialize(person = nil)
        @person = person
      end
    end
    # {urn:CreditChecker1Vi}isReliableResponse
    class IsReliableResponse
      @@schema_type = "isReliableResponse"
      @@schema_ns = "urn:CreditChecker1Vi"
      @@schema_qualified = "true"
      @@schema_element = [["response", ["SOAP::SOAPBoolean", XSD::QName.new("urn:CreditChecker1Vi", "Response")]]]
      def Response
        @response
      end
      def Response=(value)
        @response = value
      end
      def initialize(response = nil)
        @response = response
      end
    end
    # {urn:java/lang}ArrayOfboolean
    class ArrayOfboolean < ::Array
      @@schema_type = "boolean"
      @@schema_ns = "http://www.w3.org/2001/XMLSchema"
      @@schema_element = [["boolean", ["SOAP::SOAPBoolean[]", XSD::QName.new("urn:java/lang", "boolean")]]]
    end
    # {urn:com.sap.scripting.test.services.creditchecker.classes}Person
    class Person
      @@schema_type = "Person"
      @@schema_ns = "urn:com.sap.scripting.test.services.creditchecker.classes"
      @@schema_element = [["age", "SOAP::SOAPInt"], ["name", "SOAP::SOAPString"], ["purse", "Purse"]]
      attr_accessor :age
      attr_accessor :name
      attr_accessor :purse
      def initialize(age = nil, name = nil, purse = nil)
        @age = age
        @name = name
        @purse = purse
      end
    end
    # {urn:com.sap.scripting.test.services.creditchecker.classes}Purse
    class Purse
      @@schema_type = "Purse"
      @@schema_ns = "urn:com.sap.scripting.test.services.creditchecker.classes"
      @@schema_element = [["color", "SOAP::SOAPString"], ["money", "Money"]]
      attr_accessor :color
      attr_accessor :money
      def initialize(color = nil, money = nil)
        @color = color
        @money = money
      end
    end
    # {urn:com.sap.scripting.test.services.creditchecker.classes}Money
    class Money
      @@schema_type = "Money"
      @@schema_ns = "urn:com.sap.scripting.test.services.creditchecker.classes"
      @@schema_element = [["amount", "SOAP::SOAPDouble"], ["currency", "SOAP::SOAPString"]]
      attr_accessor :amount
      attr_accessor :currency
      def initialize(amount = nil, currency = nil)
        @amount = amount
        @currency = currency
      end
    end
    # {urn:com.sap.scripting.test.services.creditchecker.classes}ArrayOfPerson
    class ArrayOfPerson < ::Array
      @@schema_type = "Person"
      @@schema_ns = "urn:com.sap.scripting.test.services.creditchecker.classes"
      @@schema_element = [["Person", ["Person[]", XSD::QName.new("urn:com.sap.scripting.test.services.creditchecker.classes", "Person")]]]
    end
    The second file is <b>CreditChecker1WsdDriver.rb</b>. In it you can find a generated child class of SOAP::RPC::Driver, containing all methods of this web service, so you don't need to add every method and its parameters to call the web service.
    require 'CreditChecker1Wsd.rb'
    require 'soap/rpc/driver'
    class CreditChecker1Vi_Document < ::SOAP::RPC::Driver
      DefaultEndpointUrl = "http://mysapserver:53000/CreditChecker1/Config1?style=document"
      MappingRegistry = ::SOAP::Mapping::Registry.new
      Methods = [
      def initialize(endpoint_url = nil)
        endpoint_url ||= DefaultEndpointUrl
        super(endpoint_url, nil)
        self.mapping_registry = MappingRegistry
        init_methods
      end
    private
      def init_methods
        Methods.each do |definitions|
          opt = definitions.last
          if opt[:request_style] == :document
            add_document_operation(*definitions)
          else
            add_rpc_operation(*definitions)
            qname = definitions[0]
            name = definitions[2]
            if qname.name != name and qname.name.capitalize == name.capitalize
              ::SOAP::Mapping.define_singleton_method(self, qname.name) do |*arg|
                __send__(name, *arg)
              end
            end
          end
        end
      end
    end
    There is a problem with this script, since the <b>Methods</b> array is empty. I suppose it is due to the imports in the SAP NetWeaver WSDL, maybe wsdl2ruby is not mighty enough to handle these WSDL imports. When I succeed in overcoming this, I will post again in this thread to let everybody know.
    Message was edited by: Vasil Bachvarov

    Hi,
    I find Ruby to be really tough to consume SAP WebServices. For simple scenarios like currency conversion may it is good. But for complex scenarios such as Purchase Order entry etc..I found it very annoying to use wsdl2ruby and see that it didnt generate correct proxies.
    Until wsdl2ruby is stable enough to support complex datatypes, authentication etc. my recommendation is to use JRuby and use Java Proxies generated by NW Developer studio until pure Ruby's web service support improves.
    Following link might be of interest w.r.t wsdl2ruby
    http://derklammeraffe.blogspot.com/2006/08/working-with-wsdl2r-soap4r-and-complex.html
    Regards
    Kiran

Maybe you are looking for