Topic
  • 5 replies
  • Latest Post - ‏2013-02-12T16:16:43Z by bpaskin
SystemAdmin
SystemAdmin
37422 Posts

Pinned topic Validation of incoming message in WebSphere Application Server v8.5

‏2013-02-12T11:08:44Z |
We have created a web service application and intalled it on IBM WebSphere Apllication server v8.5.

It's just a simple test app, that returns response value like request value+1. And here is a wsdl file of service:


<?xml version=
"1.0" encoding=
"UTF-8"?><wsdl:definitions name=
"Service" targetNamespace=
"http://www.example.org/Service/" xmlns:soap=
"http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns=
"http://www.example.org/Service/" xmlns:wsdl=
"http://schemas.xmlsoap.org/wsdl/" xmlns:xsd=
"http://www.w3.org/2001/XMLSchema"> <wsdl:types> <xsd:schema targetNamespace=
"http://www.example.org/Service/"> <xsd:element name=
"PlusOne"> <xsd:complexType> <xsd:sequence> <xsd:element name=
"in" type=
"xsd:int"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name=
"PlusOneResponse"> <xsd:complexType> <xsd:sequence> <xsd:element name=
"out" type=
"xsd:int"/> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:schema> </wsdl:types> <wsdl:message name=
"PlusOneRequest"> <wsdl:part element=
"tns:PlusOne" name=
"parameters"/> </wsdl:message> <wsdl:message name=
"PlusOneResponse"> <wsdl:part element=
"tns:PlusOneResponse" name=
"parameters"/> </wsdl:message> <wsdl:portType name=
"Service"> <wsdl:operation name=
"PlusOne"> <wsdl:input message=
"tns:PlusOneRequest"/> <wsdl:output message=
"tns:PlusOneResponse"/>   </wsdl:operation> </wsdl:portType> <wsdl:binding name=
"ServiceSOAP" type=
"tns:Service"> <soap:binding style=
"document" transport=
"http://schemas.xmlsoap.org/soap/http" /> <wsdl:operation name=
"PlusOne"> <soap:operation soapAction=
"http://www.example.org/Service/PlusOne"/> <wsdl:input> <soap:body use=
"literal"/> </wsdl:input> <wsdl:output> <soap:body use=
"literal"/> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:service name=
"Service"> <wsdl:port binding=
"tns:ServiceSOAP" name=
"ServiceSOAP"> <soap:address location=
"http://localhost:9080/WS/Service"/> </wsdl:port> </wsdl:service> </wsdl:definitions>


If we send argument with String type there is now errors on server, and a responce value equals 1;

In addition there is another question: WebSphere Application server -> Admin console -> Apllications -> Application Types -> WebSphere enterprise applications -> app_name has a parameter Application reference validation, which cannot be switched and equals - Issue warnings. Can it be changed manualy, after application is already installed?
Updated on 2013-02-12T16:16:43Z at 2013-02-12T16:16:43Z by bpaskin
  • bpaskin
    bpaskin
    4666 Posts

    Re: Validation of incoming message in WebSphere Application Server v8.5

    ‏2013-02-12T12:21:40Z  
    Hi, Your web service is expecting an integer, not a String, that most likely why you are receiving an error:

    Your request:
    <xsd:element name="PlusOne">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="in" type="xsd:int"/>
              </xsd:sequence>
            </xsd:complexType>
          </xsd:element>
    


    Your response:
    <xsd:element name="PlusOneResponse">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="out" type="xsd:int"/>
              </xsd:sequence>
            </xsd:complexType>
          </xsd:element>
    

    As for your second question, it is set during the install of the application and must be set at that time.

    Regards,
    Brian
    Updated on 2014-03-25T23:50:16Z at 2014-03-25T23:50:16Z by iron-man
  • SystemAdmin
    SystemAdmin
    37422 Posts

    Re: Validation of incoming message in WebSphere Application Server v8.5

    ‏2013-02-12T12:56:58Z  
    My problem is that there is NO ERROR, or, at least, an error message. It's just responsing me 1, and do not post the error.
  • bpaskin
    bpaskin
    4666 Posts

    Re: Validation of incoming message in WebSphere Application Server v8.5

    ‏2013-02-12T13:58:48Z  
    My problem is that there is NO ERROR, or, at least, an error message. It's just responsing me 1, and do not post the error.
    Hi, can you post your code?

    Regards,
    Brian
  • SystemAdmin
    SystemAdmin
    37422 Posts

    Re: Validation of incoming message in WebSphere Application Server v8.5

    ‏2013-02-12T14:28:36Z  
    Sure.
    Here is the Service code:

    
    
    
    package org.example.service;   @WebService(name = 
    "Service", targetNamespace = 
    "http://www.example.org/Service/") @XmlSeeAlso(
    { ObjectFactory.class 
    }) 
    
    public 
    
    interface Service 
    { @WebMethod(operationName = 
    "PlusOne", action = 
    "http://www.example.org/Service/PlusOne") @WebResult(name = 
    "out", targetNamespace = 
    "") @RequestWrapper(localName = 
    "PlusOne", targetNamespace = 
    "http://www.example.org/Service/", className = 
    "org.example.service.PlusOne") @ResponseWrapper(localName = 
    "PlusOneResponse", targetNamespace = 
    "http://www.example.org/Service/", className = 
    "org.example.service.PlusOneResponse") 
    
    public 
    
    int plusOne ( @WebParam(name = 
    "in", targetNamespace = 
    "") 
    
    int in);   
    }
    


    ServiceSOAPImpl code
    
    @javax.jws.WebService(endpointInterface = 
    "org.example.service.Service", targetNamespace = 
    "http://www.example.org/Service/", serviceName = 
    "Service", portName = 
    "ServiceSOAP", wsdlLocation = 
    "WEB-INF/wsdl/Service.wsdl") 
    
    public 
    
    class ServiceSOAPImpl 
    { 
    
    public 
    
    int plusOne(
    
    int in)
    { 
    
    return in+1; 
    } 
    }
    


    Request
    
    @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = 
    "", propOrder = 
    { 
    "in" 
    }) @XmlRootElement(name = 
    "PlusOne") 
    
    public 
    
    class PlusOne 
    
    implements Serializable 
    { 
    
    protected 
    
    int in;   
    
    public 
    
    int getIn() 
    
    throws Exception 
    { 
    
    return in; 
    }   
    
    public 
    
    void setIn(
    
    int value) 
    { this.in = value; 
    } 
    }
    


    and finally - responce
    
    @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = 
    "", propOrder = 
    { 
    "out" 
    }) @XmlRootElement(name = 
    "PlusOneResponse") 
    
    public 
    
    class PlusOneResponse 
    
    implements Serializable 
    {   
    
    protected 
    
    int out;   
    
    public 
    
    int getOut() 
    { 
    
    return out; 
    }   
    
    public 
    
    void setOut(
    
    int value) 
    { this.out = value; 
    } 
    }
    
  • bpaskin
    bpaskin
    4666 Posts

    Re: Validation of incoming message in WebSphere Application Server v8.5

    ‏2013-02-12T16:16:43Z  
    Sure.
    Here is the Service code:

    <pre class="jive-pre"> package org.example.service; @WebService(name = "Service", targetNamespace = "http://www.example.org/Service/") @XmlSeeAlso( { ObjectFactory.class }) public interface Service { @WebMethod(operationName = "PlusOne", action = "http://www.example.org/Service/PlusOne") @WebResult(name = "out", targetNamespace = "") @RequestWrapper(localName = "PlusOne", targetNamespace = "http://www.example.org/Service/", className = "org.example.service.PlusOne") @ResponseWrapper(localName = "PlusOneResponse", targetNamespace = "http://www.example.org/Service/", className = "org.example.service.PlusOneResponse") public int plusOne ( @WebParam(name = "in", targetNamespace = "") int in); } </pre>

    ServiceSOAPImpl code
    <pre class="jive-pre"> @javax.jws.WebService(endpointInterface = "org.example.service.Service", targetNamespace = "http://www.example.org/Service/", serviceName = "Service", portName = "ServiceSOAP", wsdlLocation = "WEB-INF/wsdl/Service.wsdl") public class ServiceSOAPImpl { public int plusOne( int in) { return in+1; } } </pre>

    Request
    <pre class="jive-pre"> @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "in" }) @XmlRootElement(name = "PlusOne") public class PlusOne implements Serializable { protected int in; public int getIn() throws Exception { return in; } public void setIn( int value) { this.in = value; } } </pre>

    and finally - responce
    <pre class="jive-pre"> @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "out" }) @XmlRootElement(name = "PlusOneResponse") public class PlusOneResponse implements Serializable { protected int out; public int getOut() { return out; } public void setOut( int value) { this.out = value; } } </pre>
    Hi,

    I imported your WSDL and generated the classes and modified the Impl to return in + 1, and it works fine for me. I am working on 8.0.0.5.

    Brian