You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Sebastian Mauer <se...@n-unity.de> on 2008/12/29 02:41:56 UTC

SoapHeader doesn't make it trough

Hello there,

I am currently trying to implement a SOAP based WebService with CFX 2.1.3. I
opted to use JAX-WS / +Annotations rather than using the ServerFactoryBean
to make sure the generated WSDL specifies my SoapHeaders (btw is that
possible with ServerFactoryBean too?)

My Service Class Interface does define my getAccount method like this

Konto[] getAccounts(String test, @WebParam(header=true)String auth);

The resulting WSDL looks also fine:

    <wsdl:operation name="getAccounts">
      <soap:operation soapAction="" style="document"></soap:operation>
      <wsdl:input name="getAccounts">
        <soap:header message="tns:getAccounts" part="arg1" use="literal">
        </soap:header>
        <soap:body parts="parameters" use="literal"></soap:body>
      </wsdl:input>
      <wsdl:output name="getAccountsResponse">
        <soap:body use="literal"></soap:body>

      </wsdl:output>
    </wsdl:operation>

My XMLSpy does generate the request as follows:

<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
	<SOAP-ENV:Header>
		<arg1 xsi:type="xsd:string">Stringo</arg1>
	</SOAP-ENV:Header>
	<SOAP-ENV:Body>
		<m:getAccounts xmlns:m="http://cli/">
			<arg0>String</arg0>
		</m:getAccounts>
	</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

This also looks fine to me, but in the end there is never passed anything to
method parameter auth (the SoapHeader) and it will be always null. Am I
missing something, shouldn't CXF pass that trough, too? 

Greetings,

Sebastian Mauer
-- 
View this message in context: http://www.nabble.com/SoapHeader-doesn%27t-make-it-trough-tp21198055p21198055.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: SoapHeader doesn't make it trough

Posted by Daniel Kulp <dk...@apache.org>.
Can I see the <wsdl:message> corresponding to the getAccounts message?   I'd 
like to see how arg1 is defined.

It LOOKS like XMLSpy is not doing something correctly:
<arg1 xsi:type="xsd:string">Stringo</arg1>
That element isn't namespace qualified.   All "top level" elements should be 
namespace qualified.

Dan


On Sunday 28 December 2008 8:41:56 pm Sebastian Mauer wrote:
> Hello there,
>
> I am currently trying to implement a SOAP based WebService with CFX 2.1.3.
> I opted to use JAX-WS / +Annotations rather than using the
> ServerFactoryBean to make sure the generated WSDL specifies my SoapHeaders
> (btw is that possible with ServerFactoryBean too?)
>
> My Service Class Interface does define my getAccount method like this
>
> Konto[] getAccounts(String test, @WebParam(header=true)String auth);
>
> The resulting WSDL looks also fine:
>
>     <wsdl:operation name="getAccounts">
>       <soap:operation soapAction="" style="document"></soap:operation>
>       <wsdl:input name="getAccounts">
>         <soap:header message="tns:getAccounts" part="arg1" use="literal">
>         </soap:header>
>         <soap:body parts="parameters" use="literal"></soap:body>
>       </wsdl:input>
>       <wsdl:output name="getAccountsResponse">
>         <soap:body use="literal"></soap:body>
>
>       </wsdl:output>
>     </wsdl:operation>
>
> My XMLSpy does generate the request as follows:
>
> <SOAP-ENV:Envelope
> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> 	<SOAP-ENV:Header>
> 		<arg1 xsi:type="xsd:string">Stringo</arg1>

> 	</SOAP-ENV:Header>
> 	<SOAP-ENV:Body>
> 		<m:getAccounts xmlns:m="http://cli/">
> 			<arg0>String</arg0>
> 		</m:getAccounts>
> 	</SOAP-ENV:Body>
> </SOAP-ENV:Envelope>
>
> This also looks fine to me, but in the end there is never passed anything
> to method parameter auth (the SoapHeader) and it will be always null. Am I
> missing something, shouldn't CXF pass that trough, too?
>
> Greetings,
>
> Sebastian Mauer



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

Re: SoapHeader doesn't make it trough

Posted by Benson Margulies <bi...@gmail.com>.
There's a test in CXF that does this. It's called HeaderTest. It shows
this with both JAX-WS and simple.

On Sun, Dec 28, 2008 at 9:21 PM, Sebastian Mauer <se...@n-unity.de> wrote:
>
> Sure...
>
> package cli;
>
> import javax.xml.ws.Endpoint;
>
> public class Testing {
>        /**
>         * @param args
>         */
>        public static void main(String[] args) {
>                HBCIService hbciService = new HBCIService();
>                Endpoint endpoint = Endpoint.publish("http://localhost:8080/calculator",
> hbciService);
>        }
> }
>
> Implementation of IHBCIService:
>
> @WebService
> public class HBCIService implements IHBCIService {
>
>        @Resource
>        private WebServiceContext context;
>
>        @WebMethod
>        public String ping() {
>                // TODO Auto-generated method stub
>                return "pong";
>        }
>
>        @WebMethod
>        public Konto[] getAccounts(String test, @WebParam(header=true)String auth)
> {
>                // TODO Auto-generated method stub
>                        return passport.getAccounts();
>        }
>
> }
>
>
> Benson Margulies-4 wrote:
>>
>> Can we see all of your endpoint configuration?
>>
>> On Sun, Dec 28, 2008 at 8:41 PM, Sebastian Mauer <se...@n-unity.de>
>> wrote:
>>>
>>> Hello there,
>>>
>>> I am currently trying to implement a SOAP based WebService with CFX
>>> 2.1.3. I
>>> opted to use JAX-WS / +Annotations rather than using the
>>> ServerFactoryBean
>>> to make sure the generated WSDL specifies my SoapHeaders (btw is that
>>> possible with ServerFactoryBean too?)
>>>
>>> My Service Class Interface does define my getAccount method like this
>>>
>>> Konto[] getAccounts(String test, @WebParam(header=true)String auth);
>>>
>>> The resulting WSDL looks also fine:
>>>
>>>    <wsdl:operation name="getAccounts">
>>>      <soap:operation soapAction="" style="document"></soap:operation>
>>>      <wsdl:input name="getAccounts">
>>>        <soap:header message="tns:getAccounts" part="arg1" use="literal">
>>>        </soap:header>
>>>        <soap:body parts="parameters" use="literal"></soap:body>
>>>      </wsdl:input>
>>>      <wsdl:output name="getAccountsResponse">
>>>        <soap:body use="literal"></soap:body>
>>>
>>>      </wsdl:output>
>>>    </wsdl:operation>
>>>
>>> My XMLSpy does generate the request as follows:
>>>
>>> <SOAP-ENV:Envelope
>>> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
>>> xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>>>        <SOAP-ENV:Header>
>>>                <arg1 xsi:type="xsd:string">Stringo</arg1>
>>>        </SOAP-ENV:Header>
>>>        <SOAP-ENV:Body>
>>>                <m:getAccounts xmlns:m="http://cli/">
>>>                        <arg0>String</arg0>
>>>                </m:getAccounts>
>>>        </SOAP-ENV:Body>
>>> </SOAP-ENV:Envelope>
>>>
>>> This also looks fine to me, but in the end there is never passed anything
>>> to
>>> method parameter auth (the SoapHeader) and it will be always null. Am I
>>> missing something, shouldn't CXF pass that trough, too?
>>>
>>> Greetings,
>>>
>>> Sebastian Mauer
>>> --
>>> View this message in context:
>>> http://www.nabble.com/SoapHeader-doesn%27t-make-it-trough-tp21198055p21198055.html
>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/SoapHeader-doesn%27t-make-it-trough-tp21198055p21198264.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>
>

Re: SoapHeader doesn't make it trough

Posted by Sebastian Mauer <se...@n-unity.de>.
Sure...

package cli;

import javax.xml.ws.Endpoint;

public class Testing {
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		HBCIService hbciService = new HBCIService();
		Endpoint endpoint = Endpoint.publish("http://localhost:8080/calculator",
hbciService);
	}
}

Implementation of IHBCIService:

@WebService
public class HBCIService implements IHBCIService {

	@Resource
	private WebServiceContext context;
	
	@WebMethod
	public String ping() {
		// TODO Auto-generated method stub
		return "pong";
	}

	@WebMethod
	public Konto[] getAccounts(String test, @WebParam(header=true)String auth)
{
		// TODO Auto-generated method stub
			return passport.getAccounts();
	}

}


Benson Margulies-4 wrote:
> 
> Can we see all of your endpoint configuration?
> 
> On Sun, Dec 28, 2008 at 8:41 PM, Sebastian Mauer <se...@n-unity.de>
> wrote:
>>
>> Hello there,
>>
>> I am currently trying to implement a SOAP based WebService with CFX
>> 2.1.3. I
>> opted to use JAX-WS / +Annotations rather than using the
>> ServerFactoryBean
>> to make sure the generated WSDL specifies my SoapHeaders (btw is that
>> possible with ServerFactoryBean too?)
>>
>> My Service Class Interface does define my getAccount method like this
>>
>> Konto[] getAccounts(String test, @WebParam(header=true)String auth);
>>
>> The resulting WSDL looks also fine:
>>
>>    <wsdl:operation name="getAccounts">
>>      <soap:operation soapAction="" style="document"></soap:operation>
>>      <wsdl:input name="getAccounts">
>>        <soap:header message="tns:getAccounts" part="arg1" use="literal">
>>        </soap:header>
>>        <soap:body parts="parameters" use="literal"></soap:body>
>>      </wsdl:input>
>>      <wsdl:output name="getAccountsResponse">
>>        <soap:body use="literal"></soap:body>
>>
>>      </wsdl:output>
>>    </wsdl:operation>
>>
>> My XMLSpy does generate the request as follows:
>>
>> <SOAP-ENV:Envelope
>> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
>> xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>>        <SOAP-ENV:Header>
>>                <arg1 xsi:type="xsd:string">Stringo</arg1>
>>        </SOAP-ENV:Header>
>>        <SOAP-ENV:Body>
>>                <m:getAccounts xmlns:m="http://cli/">
>>                        <arg0>String</arg0>
>>                </m:getAccounts>
>>        </SOAP-ENV:Body>
>> </SOAP-ENV:Envelope>
>>
>> This also looks fine to me, but in the end there is never passed anything
>> to
>> method parameter auth (the SoapHeader) and it will be always null. Am I
>> missing something, shouldn't CXF pass that trough, too?
>>
>> Greetings,
>>
>> Sebastian Mauer
>> --
>> View this message in context:
>> http://www.nabble.com/SoapHeader-doesn%27t-make-it-trough-tp21198055p21198055.html
>> Sent from the cxf-user mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/SoapHeader-doesn%27t-make-it-trough-tp21198055p21198264.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: SoapHeader doesn't make it trough

Posted by Benson Margulies <bi...@gmail.com>.
Can we see all of your endpoint configuration?

On Sun, Dec 28, 2008 at 8:41 PM, Sebastian Mauer <se...@n-unity.de> wrote:
>
> Hello there,
>
> I am currently trying to implement a SOAP based WebService with CFX 2.1.3. I
> opted to use JAX-WS / +Annotations rather than using the ServerFactoryBean
> to make sure the generated WSDL specifies my SoapHeaders (btw is that
> possible with ServerFactoryBean too?)
>
> My Service Class Interface does define my getAccount method like this
>
> Konto[] getAccounts(String test, @WebParam(header=true)String auth);
>
> The resulting WSDL looks also fine:
>
>    <wsdl:operation name="getAccounts">
>      <soap:operation soapAction="" style="document"></soap:operation>
>      <wsdl:input name="getAccounts">
>        <soap:header message="tns:getAccounts" part="arg1" use="literal">
>        </soap:header>
>        <soap:body parts="parameters" use="literal"></soap:body>
>      </wsdl:input>
>      <wsdl:output name="getAccountsResponse">
>        <soap:body use="literal"></soap:body>
>
>      </wsdl:output>
>    </wsdl:operation>
>
> My XMLSpy does generate the request as follows:
>
> <SOAP-ENV:Envelope
> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>        <SOAP-ENV:Header>
>                <arg1 xsi:type="xsd:string">Stringo</arg1>
>        </SOAP-ENV:Header>
>        <SOAP-ENV:Body>
>                <m:getAccounts xmlns:m="http://cli/">
>                        <arg0>String</arg0>
>                </m:getAccounts>
>        </SOAP-ENV:Body>
> </SOAP-ENV:Envelope>
>
> This also looks fine to me, but in the end there is never passed anything to
> method parameter auth (the SoapHeader) and it will be always null. Am I
> missing something, shouldn't CXF pass that trough, too?
>
> Greetings,
>
> Sebastian Mauer
> --
> View this message in context: http://www.nabble.com/SoapHeader-doesn%27t-make-it-trough-tp21198055p21198055.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>
>