Generated requests & responses miss namespace prefix

Report your bugs here, Thank you!

Generated requests & responses miss namespace prefix

Postby Xarx123 » 10 Jan 2012 11:49

Hello,

I've got a very basic WSDL, and I've let SoapUI generate a sample request and a mock service for it. Inner elements of the generated request & response lack, however, the namespace prefix:

Code: Select all
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:exam="http://www.example.com/">
   <soapenv:Header/>
   <soapenv:Body>
      <exam:getGreeting>
         <!--Optional:-->
         <name>?</name>
      </exam:getGreeting>
   </soapenv:Body>
</soapenv:Envelope>


The <name> element herein should not be in the anonymous namespace, it should have the "exam" prefix, as like as the <getGreeting> element does. The same problem is in the response that I get from the mock service.

The XSD looks like this:

Code: Select all
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema version="1.0" targetNamespace="http://www.example.com/" xmlns:tns="http://www.example.com/" xmlns:xs="http://www.w3.org/2001/XMLSchema">

  <xs:element name="getGreeting" type="tns:TgetGreeting"/>

  <xs:element name="getGreetingResponse" type="tns:TgetGreetingResponse"/>

  <xs:complexType name="TgetGreeting">
    <xs:sequence>
      <xs:element name="name" type="xs:string" minOccurs="0"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="TgetGreetingResponse">
    <xs:sequence>
      <xs:element name="return" type="xs:string" minOccurs="0"/>
    </xs:sequence>
  </xs:complexType>
</xs:schema>


and the WSDL is as follows:

Code: Select all
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is Oracle JAX-WS 2.1.5. -->
<definitions targetNamespace="http://www.example.com/HelloWorld.wsdl" name="HelloWorldService" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://www.example.com/HelloWorld.wsdl" xmlns:dns="http://www.example.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
  <types>
    <xsd:schema>
      <xsd:import namespace="http://www.example.com/" schemaLocation="HelloWorldService_schema1.xsd"/>
    </xsd:schema>
  </types>
  <message name="getGreeting">
    <part name="parameters" element="dns:getGreeting"/>
  </message>
  <message name="getGreetingResponse">
    <part name="parameters" element="dns:getGreetingResponse"/>
  </message>
  <portType name="HelloWorldPortType">
    <operation name="getGreeting">
      <input message="tns:getGreeting"/>
      <output message="tns:getGreetingResponse"/>
    </operation>
  </portType>
  <binding name="HelloWorldSoapPortBinding" type="tns:HelloWorldPortType">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
    <operation name="getGreeting">
      <soap:operation soapAction="http://www.example.com/HelloWorld.wsdl#getGreeting"/>
      <input>
        <soap:body use="literal"/>
      </input>
      <output>
        <soap:body use="literal"/>
      </output>
    </operation>
  </binding>
  <service name="HelloWorldService">
    <port name="HelloWorldSoapPort" binding="tns:HelloWorldSoapPortBinding">
      <soap:address location="http://localhost:7001/business/hello/HelloWorldService"/>
    </port>
  </service>
</definitions>


I use SoapUI 4.0.1, Build dist-134-2011-09-14, Build Date 2011/09/14 13:06.
Xarx123
User
 
Posts: 3
Joined: 10 Jan 2012 11:00

Re: Generated requests & responses miss namespace prefix

Postby Xarx123 » 11 Jan 2012 17:45

I'm sorry, it was my fault, SoapUI works correctly. The XSD didn't contain the attribute @elementFormDefault, that's why the generated request & response elements didn't contain the namespace prefix. After adding this attribute:

Code: Select all
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema version="1.0" targetNamespace="http://www.example.com/" elementFormDefault="qualified"
   xmlns:tns="http://www.example.com/"
   xmlns:xs="http://www.w3.org/2001/XMLSchema">

  <xs:element name="getGreeting" type="tns:TgetGreeting"/>

  <xs:element name="getGreetingResponse" type="tns:TgetGreetingResponse"/>

  <xs:complexType name="TgetGreeting">
    <xs:sequence>
      <xs:element name="name" type="xs:string" minOccurs="0"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="TgetGreetingResponse">
    <xs:sequence>
      <xs:element name="return" type="xs:string" minOccurs="0"/>
    </xs:sequence>
  </xs:complexType>
</xs:schema>


SoapUI generates correct requests with namespace prefixes.
Xarx123
User
 
Posts: 3
Joined: 10 Jan 2012 11:00


Return to soapUI Bugs