You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by banks21 <he...@hotmail.com> on 2009/10/14 21:34:38 UTC

Re: [jira] Created: (CXF-2378) Capturing SOAP body passed from SSRS in CXF method as a parameter

Thanks Daniel for your reply I was sidetracked and had to leave this issue
now I am trying to get this thing resolved. I am just not able to get the
values passed from the SOAP message into the web service method. The method
parameters always get null.

I just want to get the soap body in the method so that I can parse the xml
and get all the parameter values.

Here is the SOAP header and related info passed from SSRS to the webservice

----------------------------

Encoding: UTF-8

Headers: {expect=[100-continue], content-type=[text/xml],
connection=[Keep-Alive], host=[127.0.0.1:9082],
soapaction=[http://localhost:9080/axis2/services/DataAccessService/query],
content-length=[328]}

Messages: 

Message:

 

Payload: <?xml version="1.0" encoding="utf-8"?>

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">

  <soap:Body>

    <query xmlns="http://dataaccessservice.my.company.com">

      <dql>getdocbaselist</dql>

      <group>1</group>

      <group_size>0</group_size>

    </query>

  </soap:Body>

</soap:Envelope>

--------------------------------------

com.company.my.dataaccessservice.internal.Request@9ab0

dql null

sGroup null

sGroupSize null

Oct 14, 2009 10:43:12 AM
com.company.my.dataaccessservice.DataAccessSoapInternalImpl query

INFO: Executing operation query

Oct 14, 2009 10:43:12 AM
org.apache.cxf.interceptor.LoggingOutInterceptor$LoggingCallback onClose

INFO: Outbound Message

---------------------------

Encoding: UTF-8

Headers: {}

Messages: 

Payload: <soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body></soap:Body></soap:Envelope>

I am using WSL first approach and here is the wsdl i used to generate the
code.
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="DataAccessSoapService" 
                  targetNamespace="http://dataaccessservice.my.company.com/" 
                  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
                  xmlns:tns="http://dataaccessservice.my.company.com/" 
                  xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
                  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
                 
xmlns:cxf="http://cxf.apache.org/transports/http/configuration">
  <wsdl:types>
		<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://dataaccessservice.my.company.com/"
attributeFormDefault="unqualified" elementFormDefault="unqualified"
targetNamespace="http://dataaccessservice.my.company.com/">
		    
		 <xs:element name="request">
               <xs:complexType>
                    <xs:sequence>
                        <xs:element name="dql" type="xs:string"
minOccurs="1" maxOccurs="1" />
                        <xs:element name="group" type="xs:string"
minOccurs="1" maxOccurs="1" />
                        <xs:element name="group_size" type="xs:string"
minOccurs="1" maxOccurs="1" />
                    </xs:sequence>
                </xs:complexType>
        </xs:element>
        <xs:element name="response">
           <xs:complexType>
                    <xs:sequence>
                        <xs:element name="Response" type="xs:string"
maxOccurs="1" minOccurs="1"/>
                    </xs:sequence>
                </xs:complexType>
        </xs:element>
		    
		    
        </xs:schema>
  </wsdl:types>
  
  <wsdl:message name="queryRequest">
    <wsdl:part name="request" element="tns:request"></wsdl:part>
  </wsdl:message>
   <wsdl:message name="queryResponse">
     <wsdl:part name="response" element="tns:response"></wsdl:part>
   </wsdl:message>
    
   <wsdl:portType name="DataAccessSoapInternal">
    <wsdl:operation name="query">
      <wsdl:input name="queryRequest" message="tns:queryRequest">
      </wsdl:input>
      <wsdl:output name="queryResponse" message="tns:queryResponse">
      </wsdl:output>
    </wsdl:operation>
  </wsdl:portType>
  
  <wsdl:binding name="DataAccessSoapServiceSoapBinding"
type="tns:DataAccessSoapInternal">
    <soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="query">
      <soap:operation soapAction="" style="document"/>
      <wsdl:input name="queryRequest">
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output name="queryResponse">
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  
  <wsdl:service name="DataAccessSoapService">
    <wsdl:port name="DataAccessSoapServicePort"
binding="tns:DataAccessSoapServiceSoapBinding">
      <soap:address
location="http://localhost:9082/DataAccessSoapServicePort"/>
      <cxf:client AllowChunking="false"/>      
    </wsdl:port>
  </wsdl:service>
  
</wsdl:definitions>

Code for the Implementation class is 

@javax.jws.WebService(name = "DataAccessSoapInternal",
                      serviceName = "DataAccessSoapService",
                      portName = "DataAccessSoapServicePort",
                      targetNamespace =
"http://dataaccessservice.my.company.com/",
                      wsdlLocation =
"file:/d:/source/infoworks/6.05/services/dataaccessservice/wsdl/DataAccess.wsdl",
                      endpointInterface =
"com.company.my.dataaccessservice.DataAccessSoapInternal")
                      
public class DataAccessSoapInternalImpl implements DataAccessSoapInternal {

    private static final Logger LOG =
Logger.getLogger(DataAccessSoapInternalImpl.class.getName());

    /* (non-Javadoc)
     * @see
com.bechtel.iw.dataaccessservice.internal.DataAccessSoapInternal#query(com.company.my.dataaccessservice.internal.Request 
request )*
     */
    public com.company.my.dataaccessservice.internal.Response query(Request
request) { 
        LOG.info("Executing operation query");
        System.out.println(request);
        
        String sDql = request.getDql();
        String sGroup = request.getGroup();
        String sGroupSize = request.getGroupSize();
        
        System.out.println("dql " + sDql );
        System.out.println("sGroup " + sGroup );
        System.out.println("sGroupSize " + sGroupSize );
        
        
        try {
            com.company.my.dataaccessservice.internal.Response _return =
null;
            return _return;
        } catch (Exception ex) {
            ex.printStackTrace();
            throw new RuntimeException(ex);
        }
    }

}


Thanks.



-- 
View this message in context: http://www.nabble.com/-jira--Created%3A-%28CXF-2378%29-Capturing-SOAP-body-passed-from-SSRS-in-CXF-method-as-a-parameter-tp24809840p25897569.html
Sent from the cxf-issues mailing list archive at Nabble.com.


Re: [jira] Created: (CXF-2378) Capturing SOAP body passed from SSRS in CXF method as a parameter

Posted by Daniel Kulp <dk...@apache.org>.
Just realized you responded to the jira email not adding a comment to the jira 
directly....

In anycase,

<query xmlns="http://dataaccessservice.my.company.com">
   <dql>getdocbaselist</dql>
....

Is still invalid according to your schema.    Your schema states:
elementFormDefault="unqualified"
but the above message sets the default namespace to dql ends up as a qualified 
element.   

The message should be either:
<ns1:query xmlns:ns1="http://dataaccessservice.my.company.com">
   <dql>getdocbaselist</dql>
....

or 

<query xmlns="http://dataaccessservice.my.company.com">
   <dql xmlns="">getdocbaselist</dql>
....


In anycase, if you update to CXF 2.2.4, I think JAXB will now generate an 
error in your case that would explain that the incoming message has unexpected 
elements.

Dan



On Wed October 14 2009 3:34:38 pm banks21 wrote:
> Thanks Daniel for your reply I was sidetracked and had to leave this issue
> now I am trying to get this thing resolved. I am just not able to get the
> values passed from the SOAP message into the web service method. The method
> parameters always get null.
> 
> I just want to get the soap body in the method so that I can parse the xml
> and get all the parameter values.
> 
> Here is the SOAP header and related info passed from SSRS to the webservice
> 
> ----------------------------
> 
> Encoding: UTF-8
> 
> Headers: {expect=[100-continue], content-type=[text/xml],
> connection=[Keep-Alive], host=[127.0.0.1:9082],
> soapaction=[http://localhost:9080/axis2/services/DataAccessService/query],
> content-length=[328]}
> 
> Messages:
> 
> Message:
> 
> 
> 
> Payload: <?xml version="1.0" encoding="utf-8"?>
> 
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
> 
>   <soap:Body>
> 
>     <query xmlns="http://dataaccessservice.my.company.com">
> 
>       <dql>getdocbaselist</dql>
> 
>       <group>1</group>
> 
>       <group_size>0</group_size>
> 
>     </query>
> 
>   </soap:Body>
> 
> </soap:Envelope>
> 
> --------------------------------------
> 
> com.company.my.dataaccessservice.internal.Request@9ab0
> 
> dql null
> 
> sGroup null
> 
> sGroupSize null
> 
> Oct 14, 2009 10:43:12 AM
> com.company.my.dataaccessservice.DataAccessSoapInternalImpl query
> 
> INFO: Executing operation query
> 
> Oct 14, 2009 10:43:12 AM
> org.apache.cxf.interceptor.LoggingOutInterceptor$LoggingCallback onClose
> 
> INFO: Outbound Message
> 
> ---------------------------
> 
> Encoding: UTF-8
> 
> Headers: {}
> 
> Messages:
> 
> Payload: <soap:Envelope
> xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body></soap:Bo
> dy></soap:Envelope>
> 
> I am using WSL first approach and here is the wsdl i used to generate the
> code.
> <?xml version="1.0" encoding="UTF-8"?>
> <wsdl:definitions name="DataAccessSoapService"
>                  
>  targetNamespace="http://dataaccessservice.my.company.com/"
>  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
>                   xmlns:tns="http://dataaccessservice.my.company.com/"
>                   xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>                   xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
> 
> xmlns:cxf="http://cxf.apache.org/transports/http/configuration">
>   <wsdl:types>
> 		<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:tns="http://dataaccessservice.my.company.com/"
> attributeFormDefault="unqualified" elementFormDefault="unqualified"
> targetNamespace="http://dataaccessservice.my.company.com/">
> 
> 		 <xs:element name="request">
>                <xs:complexType>
>                     <xs:sequence>
>                         <xs:element name="dql" type="xs:string"
> minOccurs="1" maxOccurs="1" />
>                         <xs:element name="group" type="xs:string"
> minOccurs="1" maxOccurs="1" />
>                         <xs:element name="group_size" type="xs:string"
> minOccurs="1" maxOccurs="1" />
>                     </xs:sequence>
>                 </xs:complexType>
>         </xs:element>
>         <xs:element name="response">
>            <xs:complexType>
>                     <xs:sequence>
>                         <xs:element name="Response" type="xs:string"
> maxOccurs="1" minOccurs="1"/>
>                     </xs:sequence>
>                 </xs:complexType>
>         </xs:element>
> 
> 
>         </xs:schema>
>   </wsdl:types>
> 
>   <wsdl:message name="queryRequest">
>     <wsdl:part name="request" element="tns:request"></wsdl:part>
>   </wsdl:message>
>    <wsdl:message name="queryResponse">
>      <wsdl:part name="response" element="tns:response"></wsdl:part>
>    </wsdl:message>
> 
>    <wsdl:portType name="DataAccessSoapInternal">
>     <wsdl:operation name="query">
>       <wsdl:input name="queryRequest" message="tns:queryRequest">
>       </wsdl:input>
>       <wsdl:output name="queryResponse" message="tns:queryResponse">
>       </wsdl:output>
>     </wsdl:operation>
>   </wsdl:portType>
> 
>   <wsdl:binding name="DataAccessSoapServiceSoapBinding"
> type="tns:DataAccessSoapInternal">
>     <soap:binding style="document"
> transport="http://schemas.xmlsoap.org/soap/http"/>
>     <wsdl:operation name="query">
>       <soap:operation soapAction="" style="document"/>
>       <wsdl:input name="queryRequest">
>         <soap:body use="literal"/>
>       </wsdl:input>
>       <wsdl:output name="queryResponse">
>         <soap:body use="literal"/>
>       </wsdl:output>
>     </wsdl:operation>
>   </wsdl:binding>
> 
>   <wsdl:service name="DataAccessSoapService">
>     <wsdl:port name="DataAccessSoapServicePort"
> binding="tns:DataAccessSoapServiceSoapBinding">
>       <soap:address
> location="http://localhost:9082/DataAccessSoapServicePort"/>
>       <cxf:client AllowChunking="false"/>
>     </wsdl:port>
>   </wsdl:service>
> 
> </wsdl:definitions>
> 
> Code for the Implementation class is
> 
> @javax.jws.WebService(name = "DataAccessSoapInternal",
>                       serviceName = "DataAccessSoapService",
>                       portName = "DataAccessSoapServicePort",
>                       targetNamespace =
> "http://dataaccessservice.my.company.com/",
>                       wsdlLocation =
> "file:/d:/source/infoworks/6.05/services/dataaccessservice/wsdl/DataAccess.
> wsdl", endpointInterface =
> "com.company.my.dataaccessservice.DataAccessSoapInternal")
> 
> public class DataAccessSoapInternalImpl implements DataAccessSoapInternal {
> 
>     private static final Logger LOG =
> Logger.getLogger(DataAccessSoapInternalImpl.class.getName());
> 
>     /* (non-Javadoc)
>      * @see
> com.bechtel.iw.dataaccessservice.internal.DataAccessSoapInternal#query(com.
> company.my.dataaccessservice.internal.Request request )*
>      */
>     public com.company.my.dataaccessservice.internal.Response query(Request
> request) {
>         LOG.info("Executing operation query");
>         System.out.println(request);
> 
>         String sDql = request.getDql();
>         String sGroup = request.getGroup();
>         String sGroupSize = request.getGroupSize();
> 
>         System.out.println("dql " + sDql );
>         System.out.println("sGroup " + sGroup );
>         System.out.println("sGroupSize " + sGroupSize );
> 
> 
>         try {
>             com.company.my.dataaccessservice.internal.Response _return =
> null;
>             return _return;
>         } catch (Exception ex) {
>             ex.printStackTrace();
>             throw new RuntimeException(ex);
>         }
>     }
> 
> }
> 
> 
> Thanks.
> 

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog