Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multiple header classes #36

Closed
volkerrichert opened this issue Apr 6, 2022 · 11 comments
Closed

Support multiple header classes #36

volkerrichert opened this issue Apr 6, 2022 · 11 comments

Comments

@volkerrichert
Copy link

I have a WSDL with multiple soap headers like so.

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" .....>
   <soap:Header>
      <bas:controllObject>
         ...
      </bas:controllObject>
      <bas:appMonDetailsStrict>
         ...
      </bas:appMonDetailsStrict>
   </soap:Header>
   <soap:Body>
      ....
   </soap:Body>
</soap:Envelope>

I'd like to have jackson soap to support multiple headers

@volkerrichert
Copy link
Author

I used List.of...

@volkerrichert
Copy link
Author

volkerrichert commented Apr 6, 2022

When using multiple Headers the generated Header is wrong. All header obects are called item

<ns1:Envelope xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <ns1:Header>
    <ns1:item><bpId>test</bpId>...</ns1:item>
    <ns1:item><retryObject xsi:nil="true"/></ns1:item></ns1:Header>
  <ns1:Body>...</ns1:Body>
</ns1:Envelope>

sokomishalov pushed a commit that referenced this issue Apr 12, 2022
@sokomishalov
Copy link
Owner

@volkerrichert Could you please provide minimal reproducer?

@volkerrichert
Copy link
Author

I'll try to strip down the wsdl with two header elements.

sokomishalov pushed a commit that referenced this issue Apr 12, 2022
@sokomishalov
Copy link
Owner

I've provided some test regarding this issue.
TLDR you shouldn't use lists/maps/other jdk structures as root objects for headers. Use custom wrappers with providing required namespace.

@volkerrichert
Copy link
Author

I just try to have multiple headers by using a list. T

@volkerrichert
Copy link
Author

ok, i try to anonymize the wsdl and put it in one file. But uplaod isn't allowed.

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions
        xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
        xmlns:xs="http://www.w3.org/2001/XMLSchema"
        xmlns:tns="http://www.addmore.de/GroupList/GroupList-001.wsdl"
        xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
        xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
        targetNamespace="http://www.addmore.de/GroupList/GroupList-001.wsdl">
    <wsdl:types>
        <schema xmlns="http://www.w3.org/2001/XMLSchema">
            <xs:element name="GetGroupListRequest">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="rowCount" type="integer"/>
                        <xs:element name="banList">
                            <xs:complexType>
                                <xs:sequence>
                                    <xs:element name="ban" type="integer" maxOccurs="10"/>
                                </xs:sequence>
                            </xs:complexType>
                        </xs:element>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="GetGroupListResponse">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="rowCount" type="integer"/>
                        <xs:element name="vpnGroup" type="string" minOccurs="0" maxOccurs="600"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="appMonDetailsStrict">
                <xs:complexType>
                    <xs:sequence>
                        <element name="bpId" type="string"/>
                        <element name="bpName" type="string"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <element name="controllObject">
                <xs:complexType>
                <xs:sequence>
                    <element name="timeout" type="unsignedInt"/>
                </xs:sequence></xs:complexType>
            </element>
            <element name="functionalException"></element>

            <element name="technicalException"></element>
        </schema>
    </wsdl:types>
    <wsdl:message name="appMonDetailsStrictHeader">
        <wsdl:part name="AppMonDetailsStrict" element="appMonDetailsStrict"/>
    </wsdl:message>
    <wsdl:message name="controllObject">
        <wsdl:part name="ControllObject" element="controllObject"/>
    </wsdl:message>
    <wsdl:message name="functionalException">
        <wsdl:part name="FunctionalException" element="functionalException"/>
    </wsdl:message>
    <wsdl:message name="technicalException">
        <wsdl:part name="TechnicalException" element="technicalException"/>
    </wsdl:message>
    <wsdl:message name="GetGroupListRequest">
        <wsdl:part element="GetGroupListRequest" name="GetGroupListRequest"/>
    </wsdl:message>
    <wsdl:message name="GetGroupListResponse">
        <wsdl:part element="GetGroupListResponse" name="GetGroupListResponse"/>
    </wsdl:message>
    <wsdl:portType name="GroupListPortType">
        <wsdl:operation name="GetGroupList">
            <wsdl:input message="tns:GetGroupListRequest" name="GetGroupListRequest"/>
            <wsdl:output message="tns:GetGroupListResponse" name="GetGroupListResponse"/>
            <wsdl:fault message="tns:functionalException" name="functionalException"/>
            <wsdl:fault message="tns:technicalException" name="technicalException"/>
        </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="GroupListEndpointBinding" type="tns:GroupListPortType">
        <soap12:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="GetGroupList">
            <soap12:operation soapAction="/GroupList-001/GetGroupList" soapActionRequired="true"/>
            <wsdl:input>
                <soap12:body parts="GetGroupListRequest" use="literal"/>
                <soap12:header message="tns:appMonDetailsStrictHeader" part="AppMonDetailsStrict" use="literal"
                               wsdl:required="true"/>
                <soap12:header message="tns:controllObject" part="ControllObject" use="literal"/>
            </wsdl:input>
            <wsdl:output>
                <soap12:body parts="GetGroupListResponse" use="literal"/>
            </wsdl:output>
            <wsdl:fault name="functionalException">
                <soap12:fault name="functionalException" use="literal"/>
            </wsdl:fault>
            <wsdl:fault name="technicalException">
                <soap12:fault name="technicalException" use="literal"/>
            </wsdl:fault>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name="GroupList">
        <wsdl:port binding="tns:GroupListEndpointBinding" name="GroupListEndpoint">
            <soap12:address location="http://www.addmore.de/"/>
        </wsdl:port>
    </wsdl:service>
</wsdl:definitions>

@sokomishalov
Copy link
Owner

@volkerrichert Thanks for raising it! I've implemented the possibility of having multiple classes for header.
Feature is available in 0.2.0

@volkerrichert
Copy link
Author

Hey cool! I'll take a look at it!

@volkerrichert
Copy link
Author

generate XML look good.

But, I have to write SoapMultipleHeaders<Object>. Is this useful?

@sokomishalov
Copy link
Owner

@volkerrichert Do you mean this regarding serialization or deserialization?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants