You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by ll...@email.cz on 2022/10/18 12:36:35 UTC
ws proxy server in Karaf has problems with mtom attachments
Hi,
I am trying to solve it for a very long time and I realy don't know what to do next.
I am creating new proxy for web services in Karaf 4.4.1 with Camel 3.18.1 and cxf 3.5.3. And it works fine, but I have a problem with MTOM attachments. For some reason it totally screw the message. I think the problem could have been in <removeHeaders pattern="CamelHttp*"/> because all the previous headers are gone and instead of them are different. But I haven't found a way how to remove only one of them and without it it doesn't forward the message.
Is here anyone who knows how make it work?
Thanks in advance
Tom
- Here is my simplified blueprint:
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" default-activation="lazy"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:camel="http://camel.apache.org/schema/blueprint"
xmlns:camelcxf="http://camel.apache.org/schema/blueprint/cxf"
xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd
http://camel.apache.org/schema/blueprint/cxf http://camel.apache.org/schema/blueprint/cxf/camel-cxf.xsd
">
<camelcxf:cxfEndpoint id="mtomTestEndpoint"
address="/test"
xmlns:tns="http://test.org/MtomTest"
endpointName="tns:MtomTestServiceSoap"
serviceName="tns:MtomTestService"
wsdlURL="file:etc/wsdl/mtomtest.wsdl"
>
<camelcxf:properties>
<entry key="dataFormat" value="PAYLOAD" />
<entry key="mtom-enabled" value="true" />
</camelcxf:properties>
</camelcxf:cxfEndpoint>
<camelContext id="mtomTestRoute" trace="false" xmlns="http://camel.apache.org/schema/blueprint">
<route>
<from uri="cxf:bean:mtomTestEndpoint"/>
<removeHeaders pattern="CamelHttp*"/>
<to uri="http://localhost:8299?throwExceptionOnFailure=false"/>
</route>
</camelContext>
</blueprint>
- Here is wsdl:
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="http://test.org/MtomTest"
xmlns:xmime="http://www.w3.org/2005/05/xmlmime"
targetNamespace="http://test.org/MtomTest"
>
<wsdl:types>
<xs:schema targetNamespace="http://test.org/MtomTest" xmlns:xmime="http://www.w3.org/2005/05/xmlmime" elementFormDefault="qualified">
<xs:element name="MtomTest">
<xs:complexType>
<xs:sequence>
<xs:element name="Content" type="xs:base64Binary" xmime:expectedContentTypes="application/octet-stream" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="MtomTestResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="testCheck" type="xs:integer" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
</wsdl:types>
<wsdl:message name="MtomTestIn">
<wsdl:part name="parameters" element="tns:MtomTest"/>
</wsdl:message>
<wsdl:message name="MtomTestOut">
<wsdl:part name="parameters" element="tns:MtomTestResponse"/>
</wsdl:message>
<wsdl:portType name="MtomTestServiceSoap">
<wsdl:operation name="MtomTest">
<wsdl:input message="tns:MtomTestIn"/>
<wsdl:output message="tns:MtomTestOut"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="MtomTestServiceSoap" type="tns:MtomTestServiceSoap">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="MtomTest">
<soap:operation soapAction=""/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="MtomTestService">
<wsdl:port name="MtomTestServiceSoap" binding="tns:MtomTestServiceSoap">
<soap:address location="http://localhost:8181/mtom-test"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
- original header from soapUI:
POST / HTTP/1.1^M
Content-Type: multipart/related; type="application/xop+xml"; start="<ro...@soapui.org>"; start-info="text/xml"; boundary="----=_Part_0_1885335651.1666069360756"^M
SOAPAction: ""^M
MIME-Version: 1.0^M
Content-Length: 1491^M
Host: localhost:8299^M
Connection: Keep-Alive^M
User-Agent: Apache-HttpClient/4.5.5 (Java/16.0.1)^M
^M
^M
------=_Part_0_1885335651.1666069360756^M
Content-Type: application/xop+xml; charset=UTF-8; type="text/xml"^M
Content-Transfer-Encoding: 8bit^M
Content-ID: <ro...@soapui.org>^M
^M
<soapenv:Envelope......
- forwarded header from Karaf:
POST / HTTP/1.1^M
MIME-Version: 1.0^M
operationName: MtomTest^M
operationNamespace: http://test.org/MtomTest^M
org.apache.cxf.headers.Header.list: org.apache.cxf.binding.soap.SoapHeader@45e002f5^M
User-Agent: Apache-HttpClient/4.5.5 (Java/16.0.1)^M
Transfer-Encoding: chunked^M
Content-Type: application/xop+xml^M
Host: localhost:8299^M
Connection: Keep-Alive^M
Accept-Encoding: gzip,deflate^M
^M
f6^M
<mto:MtomTest....
As you can see, even soapenv:Envelope is missing.
Re: ws proxy server in Karaf has problems with mtom attachments
Posted by ski n <ra...@gmail.com>.
Hi Tom,
I can't comment on the CXF/MTOM part, but I can say a bit about removing
headers. You note that:
" I think the problem could have been in <removeHeaders
pattern="CamelHttp*"/> because all the previous headers are gone and
instead of them are different. But I haven't found a way how to remove only
one of them and without it it doesn't forward the message. "
Headers can be removed as followed:
1. Remove a single header
Java DSL: .removeHeader("myHeader")
XML DSL: <removeHeader name="myHeader"/>
2. Remove all headers
Java DSL: .removeHeaders("*")
XML DSL: <removeHeaders pattern="*"/>
3. Remove headers by a pattern
Java DSL: .removeHeaders(" CamelHttp* ")
XML DSL: <removeHeaders pattern="CamelHttp*"/>
4. Remove headers by pattern, but exclude a specific one
Java DSL: .removeHeaders(" CamelHttp* ","CamelHttpResponseCode")
XML DSL: <removeHeaders pattern="CamelHttp*"
excludePattern="CamelHttpResponseCode"/>
5. Remove headers by pattern, but exclude some
Java DSL: .removeHeaders(" Camel* ","CamelHttp*")
XML DSL: <removeHeaders pattern="Camel*" excludePattern="CamelHttp*"/>
Raymond
On Tue, Oct 18, 2022 at 2:36 PM <ll...@email.cz> wrote:
> Hi,
>
> I am trying to solve it for a very long time and I realy don't know what
> to do next.
>
> I am creating new proxy for web services in Karaf 4.4.1 with Camel 3.18.1
> and cxf 3.5.3. And it works fine, but I have a problem with MTOM
> attachments. For some reason it totally screw the message. I think the
> problem could have been in <removeHeaders pattern="CamelHttp*"/> because
> all the previous headers are gone and instead of them are different. But I
> haven't found a way how to remove only one of them and without it it
> doesn't forward the message.
> Is here anyone who knows how make it work?
>
> Thanks in advance
>
> Tom
>
> - Here is my simplified blueprint:
> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
> default-activation="lazy"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:camel="http://camel.apache.org/schema/blueprint"
> xmlns:camelcxf="http://camel.apache.org/schema/blueprint/cxf"
> xsi:schemaLocation="
> http://www.osgi.org/xmlns/blueprint/v1.0.0
> http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
> http://camel.apache.org/schema/blueprint
> http://camel.apache.org/schema/blueprint/camel-blueprint.xsd
> http://camel.apache.org/schema/blueprint/cxf
> http://camel.apache.org/schema/blueprint/cxf/camel-cxf.xsd
> ">
>
> <camelcxf:cxfEndpoint id="mtomTestEndpoint"
> address="/test"
> xmlns:tns="
> http://test.org/MtomTest"
>
> endpointName="tns:MtomTestServiceSoap"
>
> serviceName="tns:MtomTestService"
>
> wsdlURL="file:etc/wsdl/mtomtest.wsdl"
> >
> <camelcxf:properties>
> <entry key="dataFormat" value="PAYLOAD" />
> <entry key="mtom-enabled" value="true" />
> </camelcxf:properties>
> </camelcxf:cxfEndpoint>
>
> <camelContext id="mtomTestRoute" trace="false" xmlns="
> http://camel.apache.org/schema/blueprint">
> <route>
> <from uri="cxf:bean:mtomTestEndpoint"/>
> <removeHeaders pattern="CamelHttp*"/>
> <to uri="http://localhost:8299?throwExceptionOnFailure=false
> "/>
> </route>
> </camelContext>
> </blueprint>
>
> - Here is wsdl:
> <?xml version="1.0" encoding="utf-8"?>
> <wsdl:definitions
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> xmlns:tns="http://test.org/MtomTest"
> xmlns:xmime="http://www.w3.org/2005/05/xmlmime"
> targetNamespace="http://test.org/MtomTest"
> >
> <wsdl:types>
> <xs:schema targetNamespace="http://test.org/MtomTest"
> xmlns:xmime="http://www.w3.org/2005/05/xmlmime"
> elementFormDefault="qualified">
> <xs:element name="MtomTest">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="Content" type="xs:base64Binary"
> xmime:expectedContentTypes="application/octet-stream" />
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> <xs:element name="MtomTestResponse">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="testCheck" type="xs:integer"
> minOccurs="0" />
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:schema>
> </wsdl:types>
> <wsdl:message name="MtomTestIn">
> <wsdl:part name="parameters" element="tns:MtomTest"/>
> </wsdl:message>
> <wsdl:message name="MtomTestOut">
> <wsdl:part name="parameters" element="tns:MtomTestResponse"/>
> </wsdl:message>
> <wsdl:portType name="MtomTestServiceSoap">
> <wsdl:operation name="MtomTest">
> <wsdl:input message="tns:MtomTestIn"/>
> <wsdl:output message="tns:MtomTestOut"/>
> </wsdl:operation>
> </wsdl:portType>
> <wsdl:binding name="MtomTestServiceSoap"
> type="tns:MtomTestServiceSoap">
> <soap:binding style="document" transport="
> http://schemas.xmlsoap.org/soap/http"/>
> <wsdl:operation name="MtomTest">
> <soap:operation soapAction=""/>
> <wsdl:input>
> <soap:body use="literal"/>
> </wsdl:input>
> <wsdl:output>
> <soap:body use="literal"/>
> </wsdl:output>
> </wsdl:operation>
> </wsdl:binding>
> <wsdl:service name="MtomTestService">
> <wsdl:port name="MtomTestServiceSoap"
> binding="tns:MtomTestServiceSoap">
> <soap:address location="http://localhost:8181/mtom-test"/>
> </wsdl:port>
> </wsdl:service>
> </wsdl:definitions>
>
> - original header from soapUI:
> POST / HTTP/1.1^M
> Content-Type: multipart/related; type="application/xop+xml"; start="<
> rootpart@soapui.org>"; start-info="text/xml";
> boundary="----=_Part_0_1885335651.1666069360756"^M
> SOAPAction: ""^M
> MIME-Version: 1.0^M
> Content-Length: 1491^M
> Host: localhost:8299^M
> Connection: Keep-Alive^M
> User-Agent: Apache-HttpClient/4.5.5 (Java/16.0.1)^M
> ^M
> ^M
> ------=_Part_0_1885335651.1666069360756^M
> Content-Type: application/xop+xml; charset=UTF-8; type="text/xml"^M
> Content-Transfer-Encoding: 8bit^M
> Content-ID: <ro...@soapui.org>^M
> ^M
> <soapenv:Envelope......
>
> - forwarded header from Karaf:
> POST / HTTP/1.1^M
> MIME-Version: 1.0^M
> operationName: MtomTest^M
> operationNamespace: http://test.org/MtomTest^M
> org.apache.cxf.headers.Header.list:
> org.apache.cxf.binding.soap.SoapHeader@45e002f5^M
> User-Agent: Apache-HttpClient/4.5.5 (Java/16.0.1)^M
> Transfer-Encoding: chunked^M
> Content-Type: application/xop+xml^M
> Host: localhost:8299^M
> Connection: Keep-Alive^M
> Accept-Encoding: gzip,deflate^M
> ^M
> f6^M
> <mto:MtomTest....
>
> As you can see, even soapenv:Envelope is missing.
>