You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Benson Margulies <bi...@gmail.com> on 2011/01/27 16:29:20 UTC

An interesting sort of asynchronousness in JAX-RS

The following was interesting to me, I don't know if it is interesting to
anyone else or worth adding to the doc.

Client make a JAX-RS call to service via WebClient's 'post' method.

Service streams a significant amount of data back.

WebClient.post returns, with status OK, long before server has finished
writing the response.

If the client then exits before the service finishes writing, the service
will get an EOF exception.

Re: Need CXF to break a few rules

Posted by Sergey Beryozkin <sb...@gmail.com>.
Custom XMLStreamWriters might also help, though changing namespaces at that
level may be a bit tricky

cheers, Sergey

On Thu, Jan 27, 2011 at 6:43 PM, Glen Mazza <gm...@talend.com> wrote:

> I think if you use the Dispatch class with raw XML you can send the service
> whatever you want:
> http://www.jroller.com/gmazza/entry/calling_rpc_encoded_web_services
>
>
> On 27.01.2011 13:20, Taylor Jones (tayjones) wrote:
>
>> Hi everyone, I have a bit of a weird question here. It may be trivial to
>> a more experienced user though, I'm kind of new to CXF and webservices
>> in general.
>>
>> I'm working with CXF to generate Java classes from WSDLs, with which I
>> interface with a commercial product's exposed SOAP services. The problem
>> is, the product's XML implementation is sort of funky and I kind of need
>> CXF to break a few rules to marshal the XML for the SOAP service.
>> Basically, the form of the soap request expected by the product is this:
>>
>> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
>>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>>        <soap:Header>
>>                <Auth xmlns="namespace1">
>>
>> <SessionID>5000156__171120a:10a241ff830:-7f711143139816999</SessionID>
>>                </Auth>
>>        </soap:Header>
>>        <soap:Body>
>>                <Read xmlns="namespace1">
>>                        <DataBus
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>
>> xsi:noNamespaceSchemaLocation="../xsd/read.xsd" xmlns="">
>>                                <Header version="12.0.0.5028" />
>>                                <Query>
>>                                        <Filter name="subject"
>> criteria="EQUALS">some filter text</Filter>
>>                                </Query>
>>                        </DataBus>
>>                </Read>
>>        </soap:Body>
>> </soap:Envelope>
>>
>> I've written a WSDL such that everything CXF generates is fine, verified
>> this with Wireshark, except for the namespace of the<DataBus>  tag. I
>> don't think it's possible to write a WSDL or schema in such a way that
>> CXF generates a DataBus class in a blank namespace (maybe it is, I'd
>> love to be proven wrong there). So, I tried writing an interceptor to do
>> this manually on outgoing requests, but after the<DataBus>  tag is
>> modified to have a blank namespace the child tags are suddenly generated
>> with xmlns="namespace1" attribute. It doesn't seem that there is a place
>> in the interceptor chain to prevent this change from happening, so I'm
>> pretty much out of ideas. The commercial product I'm using will not
>> accept these tags unless the namespaces are "correct"; that is to say,
>> what it expects to receive, not what is standard. Would anyone here be
>> able to help or point me in a good direction to accomplish this?
>>
>> Taylor Jones
>>
>
>
> --
> Glen Mazza
> Software Engineer, Talend (http://www.talend.com)
> blog: http://www.jroller.com/gmazza
>
>
>

Re: Need CXF to break a few rules

Posted by Glen Mazza <gm...@talend.com>.
I think if you use the Dispatch class with raw XML you can send the 
service whatever you want:
http://www.jroller.com/gmazza/entry/calling_rpc_encoded_web_services

On 27.01.2011 13:20, Taylor Jones (tayjones) wrote:
> Hi everyone, I have a bit of a weird question here. It may be trivial to
> a more experienced user though, I'm kind of new to CXF and webservices
> in general.
>
> I'm working with CXF to generate Java classes from WSDLs, with which I
> interface with a commercial product's exposed SOAP services. The problem
> is, the product's XML implementation is sort of funky and I kind of need
> CXF to break a few rules to marshal the XML for the SOAP service.
> Basically, the form of the soap request expected by the product is this:
>
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> 	<soap:Header>
> 		<Auth xmlns="namespace1">
> 	
> <SessionID>5000156__171120a:10a241ff830:-7f711143139816999</SessionID>
> 		</Auth>
> 	</soap:Header>
> 	<soap:Body>
> 		<Read xmlns="namespace1">
> 			<DataBus
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 	
> xsi:noNamespaceSchemaLocation="../xsd/read.xsd" xmlns="">
> 				<Header version="12.0.0.5028" />
> 				<Query>
> 					<Filter name="subject"
> criteria="EQUALS">some filter text</Filter>
> 				</Query>
> 			</DataBus>
> 		</Read>
> 	</soap:Body>
> </soap:Envelope>
>
> I've written a WSDL such that everything CXF generates is fine, verified
> this with Wireshark, except for the namespace of the<DataBus>  tag. I
> don't think it's possible to write a WSDL or schema in such a way that
> CXF generates a DataBus class in a blank namespace (maybe it is, I'd
> love to be proven wrong there). So, I tried writing an interceptor to do
> this manually on outgoing requests, but after the<DataBus>  tag is
> modified to have a blank namespace the child tags are suddenly generated
> with xmlns="namespace1" attribute. It doesn't seem that there is a place
> in the interceptor chain to prevent this change from happening, so I'm
> pretty much out of ideas. The commercial product I'm using will not
> accept these tags unless the namespaces are "correct"; that is to say,
> what it expects to receive, not what is standard. Would anyone here be
> able to help or point me in a good direction to accomplish this?
>
> Taylor Jones


-- 
Glen Mazza
Software Engineer, Talend (http://www.talend.com)
blog: http://www.jroller.com/gmazza



Re: Need CXF to break a few rules

Posted by Daniel Kulp <dk...@apache.org>.
Can you post your WSDL/schema?   It sounds like you have 
elementFormDefault="qualified" in there.   By default, if you have 
elementFormDefault="unqualified", it should generate the Read element  in the 
right namespace and all the child elements unqualified which is what you are 
describing.

Dan



On Thursday 27 January 2011 1:20:30 pm Taylor Jones (tayjones) wrote:
> Hi everyone, I have a bit of a weird question here. It may be trivial to
> a more experienced user though, I'm kind of new to CXF and webservices
> in general.
> 
> I'm working with CXF to generate Java classes from WSDLs, with which I
> interface with a commercial product's exposed SOAP services. The problem
> is, the product's XML implementation is sort of funky and I kind of need
> CXF to break a few rules to marshal the XML for the SOAP service.
> Basically, the form of the soap request expected by the product is this:
> 
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> 	<soap:Header>
> 		<Auth xmlns="namespace1">
> 
> <SessionID>5000156__171120a:10a241ff830:-7f711143139816999</SessionID>
> 		</Auth>
> 	</soap:Header>
> 	<soap:Body>
> 		<Read xmlns="namespace1">
> 			<DataBus
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 
> xsi:noNamespaceSchemaLocation="../xsd/read.xsd" xmlns="">
> 				<Header version="12.0.0.5028" />
> 				<Query>
> 					<Filter name="subject"
> criteria="EQUALS">some filter text</Filter>
> 				</Query>
> 			</DataBus>
> 		</Read>
> 	</soap:Body>
> </soap:Envelope>
> 
> I've written a WSDL such that everything CXF generates is fine, verified
> this with Wireshark, except for the namespace of the <DataBus> tag. I
> don't think it's possible to write a WSDL or schema in such a way that
> CXF generates a DataBus class in a blank namespace (maybe it is, I'd
> love to be proven wrong there). So, I tried writing an interceptor to do
> this manually on outgoing requests, but after the <DataBus> tag is
> modified to have a blank namespace the child tags are suddenly generated
> with xmlns="namespace1" attribute. It doesn't seem that there is a place
> in the interceptor chain to prevent this change from happening, so I'm
> pretty much out of ideas. The commercial product I'm using will not
> accept these tags unless the namespaces are "correct"; that is to say,
> what it expects to receive, not what is standard. Would anyone here be
> able to help or point me in a good direction to accomplish this?
> 
> Taylor Jones

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

Need CXF to break a few rules

Posted by "Taylor Jones (tayjones)" <ta...@cisco.com>.
Hi everyone, I have a bit of a weird question here. It may be trivial to
a more experienced user though, I'm kind of new to CXF and webservices
in general.

I'm working with CXF to generate Java classes from WSDLs, with which I
interface with a commercial product's exposed SOAP services. The problem
is, the product's XML implementation is sort of funky and I kind of need
CXF to break a few rules to marshal the XML for the SOAP service.
Basically, the form of the soap request expected by the product is this:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
	<soap:Header>
		<Auth xmlns="namespace1">
	
<SessionID>5000156__171120a:10a241ff830:-7f711143139816999</SessionID>
		</Auth>
	</soap:Header>
	<soap:Body>
		<Read xmlns="namespace1">
			<DataBus
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	
xsi:noNamespaceSchemaLocation="../xsd/read.xsd" xmlns="">
				<Header version="12.0.0.5028" />
				<Query>
					<Filter name="subject"
criteria="EQUALS">some filter text</Filter>
				</Query>
			</DataBus>
		</Read>
	</soap:Body>
</soap:Envelope>

I've written a WSDL such that everything CXF generates is fine, verified
this with Wireshark, except for the namespace of the <DataBus> tag. I
don't think it's possible to write a WSDL or schema in such a way that
CXF generates a DataBus class in a blank namespace (maybe it is, I'd
love to be proven wrong there). So, I tried writing an interceptor to do
this manually on outgoing requests, but after the <DataBus> tag is
modified to have a blank namespace the child tags are suddenly generated
with xmlns="namespace1" attribute. It doesn't seem that there is a place
in the interceptor chain to prevent this change from happening, so I'm
pretty much out of ideas. The commercial product I'm using will not
accept these tags unless the namespaces are "correct"; that is to say,
what it expects to receive, not what is standard. Would anyone here be
able to help or point me in a good direction to accomplish this?

Taylor Jones

Re: An interesting sort of asynchronousness in JAX-RS

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi Benson

On Thu, Jan 27, 2011 at 3:29 PM, Benson Margulies <bi...@gmail.com>wrote:

> The following was interesting to me, I don't know if it is interesting to
> anyone else or worth adding to the doc.
>
> Client make a JAX-RS call to service via WebClient's 'post' method.
>
> Service streams a significant amount of data back.
>
> WebClient.post returns, with status OK, long before server has finished
> writing the response.
>
> If the client then exits before the service finishes writing, the service
> will get an EOF exception.
>

How the client ends up exiting before the server finishes writing the stream
?
I suppose if the web client gets the Response back and we have the chunked
encoding case and the client
does not read the stream, only checks the status and exists, then this
failure is kind of expected ?

Cheers, Sergey