cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Felix.1973" <felix.merca...@omnipaygroup.com>
Subject CXF web service issue when using @WebParam (header=true)
Date Tue, 06 Oct 2015 07:59:32 GMT
I need help here. I have at work a CXF web service working really well
running in a WebLogic server. I recently was asked to pass some extra
parameters (for extra authentication purposes). We want these 

extra parameters to travel in the header, not as normal parameters. 

I have two different scenarios to explain. In fact, in scenario number 1,
everything works really well, I am very please with it as my web service
received the header parameters and I can validate them. But 

then, in scenario number 2, in running time, all these new parameters in the
header are NULL (and normal parameters are correctly populated!). So I
cannot validate the header ones. And I need scenario 2 to 

work as we want these extra parameters to be in the header.

Why this binding is not working in my second scenario ? there is a bug ? Am
I missing something ? Please help me. Here I describe both scenarios with
some code for clarification:

1) Here everything works fine. In my cxf-servlet.xml file I have the
endpoint defined as:

        <jaxws:endpoint id="omniWebService"
                   
implementor="server.com.omnipay.webservice.webService.ServiceImpl"
                    address="/omniWS" />

And one of the calls that my CXF web service interface is offering is for
instance this one where you can see that the 3 first parameters are
header=true, not the others.

        @WebResult (name="merchantHierarchyParentResponse")
MerchantHierarchyParentResponseDTO
    getParent(
            @WebParam(header=true, name="callerId") String callerId,
            @WebParam(header=true, name="timestamp") String timestamp,
            @WebParam(header=true, name="signature") String signature,
            @WebParam(name="institutionNumber") @XmlElement(required=true)
String institutionNumber,
            @WebParam(name="clientNumber") String clientNumber,
            @WebParam(name="ourReference") String ourReference,
            @WebParam(name="accessMerch") String accessMerch
    );

That's all. I don't think I need to show more. This is working fine. I
deploy in WebLogic and my client or soapUI or debugging or whatever I do,
the web service receives all these parameters and I can work 

with them.

2) The real endpoint I want to use in my cxf-servlet.xml is the following:

        <jaxws:endpoint id="omniWebService"
                   
implementor="server.com.omnipay.webservice.webService.ServiceImpl"
                    address="/omniWS"
wsdlLocation="WEB-INF/omniWebService.wsdl">
        <jaxws:properties>
            <entry key="schema-validation-enabled" value="true" />
        </jaxws:properties>
    </jaxws:endpoint>

And the reason to use this one is because I need a "local" WSDL that I can
edit and make changes. This "local" WSDL is the exact WSDL that WebLogic
provided me after my first deployment plus adding things 

like this plus using them instead of type="xs:string":

                
            <xs:simpleType name="institutionNumber">
                <xs:restriction base="xs:string">
                    <xs:length value="8"/>
                    <xs:pattern value="[0-9]+"/>
                </xs:restriction>
            </xs:simpleType>

This is, adding some restrictions so the WSDL will validate the user input.
For instance 00000123 is a valid institution number but 000000XX is not.

This functionality works really nice. To be honest, it forces me to maintain
a "local" WSDL file which I would prefer not but I didn't find any other way
to do it.

And here is where I have my problem. Even if I put as "local" WSDL the exact
content of the "automatic" WSDL that WebLogic provided me after deploying
(the original without any of my changes!), the result is 

that in execution time my normal parameters (institution number, client
number, etc) are correctly populated but my 3 header parameters (callerId,
timestamps and signature) are NULL.

Please any suggestion ? what I am doing wrong ? Both functionalities works
very nicely when not working together but the moment I put them together I
am having this problem in execution. Why the binding is 

working fine in scenario 1 but not in scenario 2 ?

thanks



--
View this message in context: http://cxf.547215.n5.nabble.com/CXF-web-service-issue-when-using-WebParam-header-true-tp5761481.html
Sent from the cxf-dev mailing list archive at Nabble.com.

Mime
View raw message