3

I have generated WSDL client using this answer for my WSDL. The stub is generated successfully however when I invoke the server I get below error message

undeclared namespace prefix SOAP-ENV at offset 216 of http://10.7.225.35:30002/kestrel/AirService

This is to stop the scroll bar obscuring the text 


When the request is generated I can see that targetnamespaces are added in body tag instead of soapEnvelope tag, if I change it manually and try it in SOAPUI tool , it works like charm.I tried generating client from wsimport as well but getting similar issue. Attaching request and response for reference.Also attaching the wsdl file.
Attaching WSDL file(SO not allowing me to add entire so adding partial) Thanks in advance , any help is appreciated.

Air WSDL file

<?xml version="1.0" encoding="UTF-8"?>
<definitions name="AirService"
             xmlns="http://schemas.xmlsoap.org/wsdl/"
             xmlns:xsd="http://www.w3.org/2001/XMLSchema"
             xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
             xmlns:tns="http://www.travelport.com/service/air_v46_0"
             xmlns:ns1="http://www.travelport.com/schema/air_v46_0"
             targetNamespace="http://www.travelport.com/service/air_v46_0">

    <import namespace="http://www.travelport.com/service/air_v46_0"
          location="AirAbstract.wsdl" />

     <binding name="AirPrePayBinding"
             type="tns:AirPrePayPortType">
        <soap:binding style="document"
                      transport="http://schemas.xmlsoap.org/soap/http" />
        <operation name="service">
            <soap:operation soapAction="http://localhost:8080/kestrel/AirService"/>
                <input>
                    <soap:body use="literal" />
                </input>
                <output>
                    <soap:body use="literal" />
                </output>
                <fault name="ErrorInfoMsg">
                    <soap:fault name="ErrorInfoMsg" use="literal" />
                </fault>

        </operation>
    </binding>

AirAbstract.wsdl

<?xml version="1.0" encoding="UTF-8"?>

<definitions name="AirService"
             xmlns="http://schemas.xmlsoap.org/wsdl/"
             xmlns:xsd="http://www.w3.org/2001/XMLSchema"
             xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
             xmlns:tns="http://www.travelport.com/service/air_v46_0"
             xmlns:ns1="http://www.travelport.com/schema/air_v46_0"
             targetNamespace="http://www.travelport.com/service/air_v46_0">

    <import namespace="http://www.travelport.com/service/air_v46_0"
          location="AirAbstract.wsdl" />

     <binding name="AirPrePayBinding"
             type="tns:AirPrePayPortType">
        <soap:binding style="document"
                      transport="http://schemas.xmlsoap.org/soap/http" />
        <operation name="service">
            <soap:operation soapAction="http://localhost:8080/kestrel/AirService"/>
                <input>
                    <soap:body use="literal" />
                </input>
                <output>
                    <soap:body use="literal" />
                </output>
                <fault name="ErrorInfoMsg">
                    <soap:fault name="ErrorInfoMsg" use="literal" />
                </fault>

        </operation>
    </binding>     

Request

<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Header />
    <S:Body xmlns:ns1="http://www.travelport.com/schema/air_v46_0" xmlns:ns2="http://www.travelport.com/schema/common_v46_0" xmlns:ns3="http://www.travelport.com/schema/vehicle_v46_0" xmlns:ns4="http://www.travelport.com/schema/rail_v46_0" xmlns:ns5="http://www.travelport.com/schema/cruise_v46_0" xmlns:ns6="http://www.travelport.com/schema/hotel_v46_0" xmlns:ns7="http://www.travelport.com/schema/passive_v46_0" xmlns:ns8="http://www.travelport.com/schema/universal_v46_0" xmlns:ns9="http://www.travelport.com/soa/common/security/SessionContext_v1">
        <ns1:LowFareSearchReq ReturnUpsellFare="true" TargetBranch="P7111432">
            <ns2:BillingPointOfSaleInfo OriginApplication="UAPI" />
            <ns1:SearchAirLeg>
                <ns1:SearchOrigin>
                    <ns2:CityOrAirport Code="BLR" />
                </ns1:SearchOrigin>
                <ns1:SearchDestination>
                    <ns2:CityOrAirport Code="JAI" />
                </ns1:SearchDestination>
                <ns1:SearchDepTime PreferredTime="2019-03-22" />
                <ns1:AirLegModifiers>
                    <ns1:PermittedCabins>
                        <ns2:CabinClass Type="Economy" />
                    </ns1:PermittedCabins>
                </ns1:AirLegModifiers>
            </ns1:SearchAirLeg>
            <ns1:AirSearchModifiers>
                <ns1:PreferredProviders>
                    <ns2:Provider Code="1G" />
                </ns1:PreferredProviders>
            </ns1:AirSearchModifiers>
            <ns2:SearchPassenger Code="ADT" />
            <ns2:SearchPassenger Code="INF" PricePTCOnly="true" />
            <ns2:SearchPassenger Code="CNN" />
            <ns1:AirPricingModifiers CurrencyType="INR" FaresIndicator="AllFares" />
        </ns1:LowFareSearchReq>
    </S:Body>
</S:Envelope>

Response

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <SOAP-ENV:Header />
    <SOAP-ENV:Body>
        <SOAP-ENV:Fault>
            <SOAP-ENV:faultcode>500</SOAP-ENV:faultcode>
            <SOAP-ENV:faultstring>undeclared namespace prefix SOAP-ENV at offset 216 of http://10.7.225.35:30002/kestrel/AirService</SOAP-ENV:faultstring>
            <SOAP-ENV:faultactor></SOAP-ENV:faultactor>
            <SOAP-ENV:detail>undeclared namespace prefix SOAP-ENV at offset 216 of http://10.7.225.35:30002/kestrel/AirService</SOAP-ENV:detail>
        </SOAP-ENV:Fault>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
stringy05
  • 6,511
  • 32
  • 38
Narendra Jaggi
  • 1,297
  • 11
  • 33
  • Please update your question with the used CXF version. And please, update your wsdls, they are incomplete. – m4gic Jan 03 '19 at 14:49
  • cxf-codegen-plugin is 3.2.1, also SO is not allowing me to put entire WSDLs , u can go to this link https://support.travelport.com/webhelp/uapi/uAPI.htm#Resources/uAPI_WSDLschema_Release-V18.4.1.19.zip and download the entire set, m trying for Air.wsdl, SharedBooking.wsdl and Universal.wsdl – Narendra Jaggi Jan 03 '19 at 16:14
  • 1
    I downloaded the wsdls from the URL you provided. It seems they released a new version (v47), I made a mock service out of it, and using your request it worked with and without the mentioned tag after I updated the namespace versions. However in the downloaded zip there were some errors around the SessionContext namespace. – m4gic Jan 04 '19 at 10:30
  • what namespace version you updated? – Narendra Jaggi Jan 04 '19 at 10:32
  • In the uAPI_WSDLschema_Release-V18.4.1.19.zip file, in CustomerProfileAbstract.wsdl, the SessionContext_v1_0 namespace does not exist, and in the related import declaration (SessionContext_v1_0.xsd) is also wrong. But the SessionContext_v1.xsd can be found in the zip. – m4gic Jan 04 '19 at 10:39

1 Answers1

0

On the SOAP request, namespace of SOAP-ENV is a duplicate of the S namespace.

<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Header />
    <S:Body xmlns:ns1="http://www.travelport.com/schema/air_v46_0" >

... snip ...

</S:Envelope>

I guess the parser doesn't like duplicated namespace prefixes, so change the request to use S as the prefix for the header (or remove it as it's not populated)

<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/" >    
    <S:Header />
    <S:Body xmlns:ns1="http://www.travelport.com/schema/air_v46_0" >

</S:Envelope>

As for the other namespaces, it shouldn't matter where in the document you declare the namespaces, as long as they are declared before they are used.

If you post the stub code that is being generated by CXF then we can probably identify the problem with that.

stringy05
  • 6,511
  • 32
  • 38
  • repetition of SOAP-ENV is not causing the issue, when trying in SOAP-UI , If copy the body to Envelope tag, it works fine. Also I want to know if I can control where the namespace should appear – Narendra Jaggi Jan 07 '19 at 06:23
  • what's an example of a request that works through SOAP UI? Either way if the problem is with the client that was generated, then post the code and it will probably be a straightforward fix to that – stringy05 Jan 07 '19 at 08:22
  • the request which I attached above will work, if I remove the namspaces declaration from body tag and it to enevelope tag..Earlier this was how request was generated in my system however in my colleague system above mentioned request was generated, So it kept fluctuating and giving nightmares. – Narendra Jaggi Jan 07 '19 at 08:53