You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Nianhua Li (JIRA)" <ji...@apache.org> on 2007/11/21 05:27:42 UTC

[jira] Created: (CXF-1226) Missing input/output param namespace in SOAP

Missing input/output param namespace in SOAP
--------------------------------------------

                 Key: CXF-1226
                 URL: https://issues.apache.org/jira/browse/CXF-1226
             Project: CXF
          Issue Type: Bug
    Affects Versions: 2.0.3, 2.0.2
         Environment: Windows XP; Tomcat 5.5
            Reporter: Nianhua Li


I am using the java-first approach with spring configuration on cxf 2.0.3 and tomcat 5.5. I specified namespace for all the input and output parameters via @WebParam and @WebResult annotation. But the namespace was somehow missing from the SOAP message.

You can reproduce the problem by using the following test code (server side):

=================web.xml========================================
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
	<context-param>
		<param-name>contextConfigLocation</param-name>
		<param-value>WEB-INF/beans.xml</param-value>
	</context-param>
	<listener>
		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
	</listener>
	<servlet>
		<servlet-name>CXFServlet</servlet-name>
		<display-name>CXF Servlet</display-name>
		<servlet-class>
			org.apache.cxf.transport.servlet.CXFServlet
		</servlet-class>
		<load-on-startup>1</load-on-startup>
	</servlet>
	<servlet-mapping>
		<servlet-name>CXFServlet</servlet-name>
		<url-pattern>/*</url-pattern>
	</servlet-mapping>
</web-app>
---------------------------------------------------------------------------------------------------------------
=================beans.xml=======================================
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:jaxws="http://cxf.apache.org/jaxws"
	xmlns:cxf="http://cxf.apache.org/core"
	xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
	<import resource="classpath:META-INF/cxf/cxf.xml" />
	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
    <bean id="logInbound" class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
    <bean id="logOutbound" class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
    <cxf:bus>
        <cxf:inInterceptors> <ref bean="logInbound"/>  </cxf:inInterceptors>
        <cxf:outInterceptors> <ref bean="logOutbound"/> </cxf:outInterceptors>
        <cxf:inFaultInterceptors>  <ref bean="logOutbound"/>  </cxf:inFaultInterceptors>
    </cxf:bus> 
    <jaxws:endpoint   id="helloWorld"  implementor="demo.spring.HelloWorldImpl" 	  address="/HelloWorld" />
</beans>
-----------------------------------------------------------------------------------------------------------------------
=================HelloWorld.java=======================================
package demo.spring;

import javax.jws.WebService;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.xml.ws.ResponseWrapper;
import javax.xml.ws.RequestWrapper;
import javax.jws.soap.SOAPBinding;

@WebService(name="MyHelloWorldService", targetNamespace="http://nstest.helloworld")
@SOAPBinding(	parameterStyle=SOAPBinding.ParameterStyle.WRAPPED,
				style=SOAPBinding.Style.DOCUMENT,
				use= SOAPBinding.Use.LITERAL	)
public interface HelloWorld {
	@WebMethod
	@WebResult(name="MyResult", targetNamespace="http://nstest.helloworld")
    String sayHi(@WebParam(name="MyInput", targetNamespace="http://nstest.helloworld") String text);
}
-----------------------------------------------------------------------------------------------------------------------
=================HelloWorldImpl.java=======================================
package demo.spring;

import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;

@WebService(endpointInterface = "demo.spring.HelloWorld")
public class HelloWorldImpl implements HelloWorld {
    public String sayHi(String text) {
        return "Hello " + text;
    }
}
-----------------------------------------------------------------------------------------------------------------------

Create WAR from the above code, deploy to tomcat, here is the WSDL I got from http://localhost:8080/...::

=======main WSDL: http://localhost:8080/spring_http/HelloWorld?wsdl=================
<?xml version="1.0" encoding="utf-8" ?> 
- <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://nstest.helloworld" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://spring.demo/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="HelloWorldImplService" targetNamespace="http://spring.demo/">
  <wsdl:import location="http://localhost:8080/spring_http/HelloWorld?wsdl=MyHelloWorldService.wsdl" namespace="http://nstest.helloworld" /> 
- <wsdl:binding name="HelloWorldImplServiceSoapBinding" type="ns1:MyHelloWorldService">
  <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> 
- <wsdl:operation name="sayHi">
  <soap:operation soapAction="" style="document" /> 
- <wsdl:input name="sayHi">
  <soap:body use="literal" /> 
  </wsdl:input>
- <wsdl:output name="sayHiResponse">
  <soap:body use="literal" /> 
  </wsdl:output>
  </wsdl:operation>
  </wsdl:binding>
- <wsdl:service name="HelloWorldImplService">
- <wsdl:port binding="tns:HelloWorldImplServiceSoapBinding" name="HelloWorldImplPort">
  <soap:address location="http://localhost:8080/spring_http/HelloWorld" /> 
  </wsdl:port>
  </wsdl:service>
  </wsdl:definitions>
-----------------------------------------------------------------------------------------------------------------------------------------------
=====imported WSDL: http://localhost:8080/spring_http/HelloWorld?wsdl=MyHelloWorldService.wsdl====
<?xml version="1.0" encoding="utf-8" ?> 
- <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://nstest.helloworld" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="MyHelloWorldService" targetNamespace="http://nstest.helloworld">
- <wsdl:types>
- <xsd:schema xmlns="http://nstest.helloworld" xmlns:tns="http://spring.demo/" attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://nstest.helloworld" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <import xmlns="http://www.w3.org/2001/XMLSchema" namespace="http://spring.demo/" /> 
  <xsd:element name="sayHi" type="sayHi" /> 
- <xsd:complexType name="sayHi">
- <xsd:sequence>
  <xsd:element minOccurs="0" name="MyInput" type="xsd:string" /> 
  </xsd:sequence>
  </xsd:complexType>
  <xsd:element name="sayHiResponse" type="sayHiResponse" /> 
- <xsd:complexType name="sayHiResponse">
- <xsd:sequence>
  <xsd:element minOccurs="0" name="MyResult" type="xsd:string" /> 
  </xsd:sequence>
  </xsd:complexType>
  </xsd:schema>
  </wsdl:types>
- <wsdl:message name="sayHi">
  <wsdl:part element="ns1:sayHi" name="parameters" /> 
  </wsdl:message>
- <wsdl:message name="sayHiResponse">
  <wsdl:part element="ns1:sayHiResponse" name="parameters" /> 
  </wsdl:message>
- <wsdl:portType name="MyHelloWorldService">
- <wsdl:operation name="sayHi">
  <wsdl:input message="ns1:sayHi" name="sayHi" /> 
  <wsdl:output message="ns1:sayHiResponse" name="sayHiResponse" /> 
  </wsdl:operation>
  </wsdl:portType>
  </wsdl:definitions>
-------------------------------------------------------------------------------------------------------------------------------------------

Create client from WSDL by using wsdl2java. The namespaces of input/output parameters have already been missing from the generated service interface:
================MyHelloWorldService.java (generated by wsdl2java)====================== 
package helloworld.nstest;

import javax.jws.WebParam.Mode;
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding.Style;
import javax.jws.soap.SOAPBinding;
import javax.jws.WebMethod;
import javax.jws.WebResult;
import javax.xml.ws.RequestWrapper;
import javax.xml.ws.ResponseWrapper;

/**
 * This class was generated by Apache CXF (incubator) 2.0.3-incubator
 * Tue Nov 20 22:45:47 EST 2007
 * Generated source version: 2.0.3-incubator
 * 
 */

@WebService(targetNamespace = "http://nstest.helloworld", name = "MyHelloWorldService")

public interface MyHelloWorldService {

    @ResponseWrapper(targetNamespace = "http://nstest.helloworld", className = "helloworld.nstest.SayHiResponse", localName = "sayHiResponse")
    @RequestWrapper(targetNamespace = "http://nstest.helloworld", className = "helloworld.nstest.SayHi", localName = "sayHi")
    @WebResult(targetNamespace = "", name = "MyResult")
    @WebMethod
    public java.lang.String sayHi(
        @WebParam(targetNamespace = "", name = "MyInput")
        java.lang.String myInput
    );
}
===================================================================

Modify the generated client:
========MyHelloWorldService_HelloWorldImplPort_Client.java (generated by wsdl2java)======
package helloworld.nstest;

import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import javax.xml.namespace.QName;
import demo.spring.HelloWorldImplService;
import javax.jws.WebMethod;
import javax.jws.WebResult;
import javax.xml.ws.RequestWrapper;
import javax.xml.ws.ResponseWrapper;

public final class MyHelloWorldService_HelloWorldImplPort_Client {
    private static final QName SERVICE_NAME = new QName("http://spring.demo/", "HelloWorldImplService");
    private MyHelloWorldService_HelloWorldImplPort_Client() {
    }
    public static void main(String args[]) throws Exception {
      
        HelloWorldImplService ss = new HelloWorldImplService();
        MyHelloWorldService port = ss.getHelloWorldImplPort();     
        {
        System.out.println("Invoking sayHi...");
        java.lang.String _sayHi_myInput = "ABC";
        java.lang.String _sayHi__return = port.sayHi(_sayHi_myInput);
        System.out.println("sayHi.result=" + _sayHi__return);
        }
        System.exit(0);
    }
}
--------------------------------------------------------------------------------------------------------

SOAP message captured on server-side:
--------------------------------------
Encoding: UTF-8
Headers: {connection=[keep-alive], cache-control=[no-cache], host=[localhost:808
0], user-agent=[Java/1.5.0_12], transfer-encoding=[chunked], pragma=[no-cache],
content-type=[text/xml; charset=UTF-8], accept=[*], soapaction=[""]}
Message:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body
><ns2:sayHi xmlns:ns2="http://nstest.helloworld"><MyInput>ABC</MyInput></ns2:say
Hi></soap:Body></soap:Envelope>
--------------------------------------
Nov 20, 2007 10:51:13 PM org.apache.cxf.interceptor.LoggingOutInterceptor$Loggin
gCallback onClose
INFO: Outbound Message:
--------------------------------------
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body
><ns1:sayHiResponse xmlns:ns1="http://nstest.helloworld"><MyResult>Hello ABC</My
Result></ns1:sayHiResponse></soap:Body></soap:Envelope>-------------------------
-------------

You can see that both "MyInput" and "MyResult" have no namespace.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-1226) elementFormDefault from package-info.java ignored with JAXWS+JAXB when there are no beans

Posted by "Nianhua Li (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-1226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12545698 ] 

Nianhua Li commented on CXF-1226:
---------------------------------

Thanks Benson. You are right that the attribute elementFormDefault  in WSDL is related to java-soap mapping. In another world, the input/output parameters won't have namespaces when elementFormDefault=unqualified. 

In the project I am working on, the data types (e.g. TransactionTypeFull in the example below) of input/output parameters are defined in an xml schema. The input/output parameters are defined in SEI. They have different namespaces:

@WebMethod
@WebResult(name="MyResult", targetNamespace="http://nstest.transaction")
    TransactionTypeFull submit(@WebParam(name="Transaction", targetNamespace="http://nstest.bean") TransactionTypeFull body);

I mapped the namespace "http://nstest.bean" to one java package, and mapped the SEI and implementor to the other java package. Therefore it is basically the same as if I only use simple xsd types. In another word, JAXB is not involved in the processing of SEI annotation.

I was using xfire 1.2.6 for this project, and had never had this problem. Now I want to migrate to cxf to take advantage of its RESTful support ... For this namespace issue, I probably have to define some dummy data types for namespace "http://nstest.transaction" so that JAXB can get involved. Thanks again for the help. At least I have a work around now, even though it is not pretty.

> elementFormDefault from package-info.java ignored with JAXWS+JAXB when there are no beans
> -----------------------------------------------------------------------------------------
>
>                 Key: CXF-1226
>                 URL: https://issues.apache.org/jira/browse/CXF-1226
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.0.2, 2.0.3
>         Environment: Windows XP; Tomcat 5.5
>            Reporter: Nianhua Li
>            Assignee: Benson Margulies
>             Fix For: 2.0.3
>
>
> I am using the java-first approach with spring configuration on cxf 2.0.3 and tomcat 5.5. I specified namespace for all the input and output parameters via @WebParam and @WebResult annotation. But the namespace was somehow missing from the SOAP message.
> You can reproduce the problem by using the following test code (server side):
> =================web.xml========================================
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <!DOCTYPE web-app
>     PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
>     "http://java.sun.com/dtd/web-app_2_3.dtd">
> <web-app>
> 	<context-param>
> 		<param-name>contextConfigLocation</param-name>
> 		<param-value>WEB-INF/beans.xml</param-value>
> 	</context-param>
> 	<listener>
> 		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
> 	</listener>
> 	<servlet>
> 		<servlet-name>CXFServlet</servlet-name>
> 		<display-name>CXF Servlet</display-name>
> 		<servlet-class>
> 			org.apache.cxf.transport.servlet.CXFServlet
> 		</servlet-class>
> 		<load-on-startup>1</load-on-startup>
> 	</servlet>
> 	<servlet-mapping>
> 		<servlet-name>CXFServlet</servlet-name>
> 		<url-pattern>/*</url-pattern>
> 	</servlet-mapping>
> </web-app>
> ---------------------------------------------------------------------------------------------------------------
> =================beans.xml=======================================
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 	xmlns:jaxws="http://cxf.apache.org/jaxws"
> 	xmlns:cxf="http://cxf.apache.org/core"
> 	xsi:schemaLocation="
> http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
> http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
> http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
> 	<import resource="classpath:META-INF/cxf/cxf.xml" />
> 	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
> 	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
>     <bean id="logInbound" class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
>     <bean id="logOutbound" class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
>     <cxf:bus>
>         <cxf:inInterceptors> <ref bean="logInbound"/>  </cxf:inInterceptors>
>         <cxf:outInterceptors> <ref bean="logOutbound"/> </cxf:outInterceptors>
>         <cxf:inFaultInterceptors>  <ref bean="logOutbound"/>  </cxf:inFaultInterceptors>
>     </cxf:bus> 
>     <jaxws:endpoint   id="helloWorld"  implementor="demo.spring.HelloWorldImpl" 	  address="/HelloWorld" />
> </beans>
> -----------------------------------------------------------------------------------------------------------------------
> =================HelloWorld.java=======================================
> package demo.spring;
> import javax.jws.WebService;
> import javax.jws.WebMethod;
> import javax.jws.WebParam;
> import javax.jws.WebResult;
> import javax.xml.ws.ResponseWrapper;
> import javax.xml.ws.RequestWrapper;
> import javax.jws.soap.SOAPBinding;
> @WebService(name="MyHelloWorldService", targetNamespace="http://nstest.helloworld")
> @SOAPBinding(	parameterStyle=SOAPBinding.ParameterStyle.WRAPPED,
> 				style=SOAPBinding.Style.DOCUMENT,
> 				use= SOAPBinding.Use.LITERAL	)
> public interface HelloWorld {
> 	@WebMethod
> 	@WebResult(name="MyResult", targetNamespace="http://nstest.helloworld")
>     String sayHi(@WebParam(name="MyInput", targetNamespace="http://nstest.helloworld") String text);
> }
> -----------------------------------------------------------------------------------------------------------------------
> =================HelloWorldImpl.java=======================================
> package demo.spring;
> import javax.jws.WebService;
> import javax.jws.soap.SOAPBinding;
> @WebService(endpointInterface = "demo.spring.HelloWorld")
> public class HelloWorldImpl implements HelloWorld {
>     public String sayHi(String text) {
>         return "Hello " + text;
>     }
> }
> -----------------------------------------------------------------------------------------------------------------------
> Create WAR from the above code, deploy to tomcat, here is the WSDL I got from http://localhost:8080/...::
> =======main WSDL: http://localhost:8080/spring_http/HelloWorld?wsdl=================
> <?xml version="1.0" encoding="utf-8" ?> 
> - <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://nstest.helloworld" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://spring.demo/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="HelloWorldImplService" targetNamespace="http://spring.demo/">
>   <wsdl:import location="http://localhost:8080/spring_http/HelloWorld?wsdl=MyHelloWorldService.wsdl" namespace="http://nstest.helloworld" /> 
> - <wsdl:binding name="HelloWorldImplServiceSoapBinding" type="ns1:MyHelloWorldService">
>   <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> 
> - <wsdl:operation name="sayHi">
>   <soap:operation soapAction="" style="document" /> 
> - <wsdl:input name="sayHi">
>   <soap:body use="literal" /> 
>   </wsdl:input>
> - <wsdl:output name="sayHiResponse">
>   <soap:body use="literal" /> 
>   </wsdl:output>
>   </wsdl:operation>
>   </wsdl:binding>
> - <wsdl:service name="HelloWorldImplService">
> - <wsdl:port binding="tns:HelloWorldImplServiceSoapBinding" name="HelloWorldImplPort">
>   <soap:address location="http://localhost:8080/spring_http/HelloWorld" /> 
>   </wsdl:port>
>   </wsdl:service>
>   </wsdl:definitions>
> -----------------------------------------------------------------------------------------------------------------------------------------------
> =====imported WSDL: http://localhost:8080/spring_http/HelloWorld?wsdl=MyHelloWorldService.wsdl====
> <?xml version="1.0" encoding="utf-8" ?> 
> - <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://nstest.helloworld" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="MyHelloWorldService" targetNamespace="http://nstest.helloworld">
> - <wsdl:types>
> - <xsd:schema xmlns="http://nstest.helloworld" xmlns:tns="http://spring.demo/" attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://nstest.helloworld" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>   <import xmlns="http://www.w3.org/2001/XMLSchema" namespace="http://spring.demo/" /> 
>   <xsd:element name="sayHi" type="sayHi" /> 
> - <xsd:complexType name="sayHi">
> - <xsd:sequence>
>   <xsd:element minOccurs="0" name="MyInput" type="xsd:string" /> 
>   </xsd:sequence>
>   </xsd:complexType>
>   <xsd:element name="sayHiResponse" type="sayHiResponse" /> 
> - <xsd:complexType name="sayHiResponse">
> - <xsd:sequence>
>   <xsd:element minOccurs="0" name="MyResult" type="xsd:string" /> 
>   </xsd:sequence>
>   </xsd:complexType>
>   </xsd:schema>
>   </wsdl:types>
> - <wsdl:message name="sayHi">
>   <wsdl:part element="ns1:sayHi" name="parameters" /> 
>   </wsdl:message>
> - <wsdl:message name="sayHiResponse">
>   <wsdl:part element="ns1:sayHiResponse" name="parameters" /> 
>   </wsdl:message>
> - <wsdl:portType name="MyHelloWorldService">
> - <wsdl:operation name="sayHi">
>   <wsdl:input message="ns1:sayHi" name="sayHi" /> 
>   <wsdl:output message="ns1:sayHiResponse" name="sayHiResponse" /> 
>   </wsdl:operation>
>   </wsdl:portType>
>   </wsdl:definitions>
> -------------------------------------------------------------------------------------------------------------------------------------------
> Create client from WSDL by using wsdl2java. The namespaces of input/output parameters have already been missing from the generated service interface:
> ================MyHelloWorldService.java (generated by wsdl2java)====================== 
> package helloworld.nstest;
> import javax.jws.WebParam.Mode;
> import javax.jws.WebParam;
> import javax.jws.WebService;
> import javax.jws.soap.SOAPBinding.Style;
> import javax.jws.soap.SOAPBinding;
> import javax.jws.WebMethod;
> import javax.jws.WebResult;
> import javax.xml.ws.RequestWrapper;
> import javax.xml.ws.ResponseWrapper;
> /**
>  * This class was generated by Apache CXF (incubator) 2.0.3-incubator
>  * Tue Nov 20 22:45:47 EST 2007
>  * Generated source version: 2.0.3-incubator
>  * 
>  */
> @WebService(targetNamespace = "http://nstest.helloworld", name = "MyHelloWorldService")
> public interface MyHelloWorldService {
>     @ResponseWrapper(targetNamespace = "http://nstest.helloworld", className = "helloworld.nstest.SayHiResponse", localName = "sayHiResponse")
>     @RequestWrapper(targetNamespace = "http://nstest.helloworld", className = "helloworld.nstest.SayHi", localName = "sayHi")
>     @WebResult(targetNamespace = "", name = "MyResult")
>     @WebMethod
>     public java.lang.String sayHi(
>         @WebParam(targetNamespace = "", name = "MyInput")
>         java.lang.String myInput
>     );
> }
> ===================================================================
> Modify the generated client:
> ========MyHelloWorldService_HelloWorldImplPort_Client.java (generated by wsdl2java)======
> package helloworld.nstest;
> import java.io.File;
> import java.net.MalformedURLException;
> import java.net.URL;
> import javax.xml.namespace.QName;
> import demo.spring.HelloWorldImplService;
> import javax.jws.WebMethod;
> import javax.jws.WebResult;
> import javax.xml.ws.RequestWrapper;
> import javax.xml.ws.ResponseWrapper;
> public final class MyHelloWorldService_HelloWorldImplPort_Client {
>     private static final QName SERVICE_NAME = new QName("http://spring.demo/", "HelloWorldImplService");
>     private MyHelloWorldService_HelloWorldImplPort_Client() {
>     }
>     public static void main(String args[]) throws Exception {
>       
>         HelloWorldImplService ss = new HelloWorldImplService();
>         MyHelloWorldService port = ss.getHelloWorldImplPort();     
>         {
>         System.out.println("Invoking sayHi...");
>         java.lang.String _sayHi_myInput = "ABC";
>         java.lang.String _sayHi__return = port.sayHi(_sayHi_myInput);
>         System.out.println("sayHi.result=" + _sayHi__return);
>         }
>         System.exit(0);
>     }
> }
> --------------------------------------------------------------------------------------------------------
> SOAP message captured on server-side:
> --------------------------------------
> Encoding: UTF-8
> Headers: {connection=[keep-alive], cache-control=[no-cache], host=[localhost:808
> 0], user-agent=[Java/1.5.0_12], transfer-encoding=[chunked], pragma=[no-cache],
> content-type=[text/xml; charset=UTF-8], accept=[*], soapaction=[""]}
> Message:
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body
> ><ns2:sayHi xmlns:ns2="http://nstest.helloworld"><MyInput>ABC</MyInput></ns2:say
> Hi></soap:Body></soap:Envelope>
> --------------------------------------
> Nov 20, 2007 10:51:13 PM org.apache.cxf.interceptor.LoggingOutInterceptor$Loggin
> gCallback onClose
> INFO: Outbound Message:
> --------------------------------------
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body
> ><ns1:sayHiResponse xmlns:ns1="http://nstest.helloworld"><MyResult>Hello ABC</My
> Result></ns1:sayHiResponse></soap:Body></soap:Envelope>-------------------------
> -------------
> You can see that both "MyInput" and "MyResult" have no namespace.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CXF-1226) elementFormDefault from package-info.java ignored with JAXWS+JAXB when there are no beans

Posted by "Benson Margulies (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-1226?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Benson Margulies updated CXF-1226:
----------------------------------

    Summary: elementFormDefault from package-info.java ignored with JAXWS+JAXB when there are no beans  (was: Missing input/output param namespace in SOAP)

> elementFormDefault from package-info.java ignored with JAXWS+JAXB when there are no beans
> -----------------------------------------------------------------------------------------
>
>                 Key: CXF-1226
>                 URL: https://issues.apache.org/jira/browse/CXF-1226
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.0.2, 2.0.3
>         Environment: Windows XP; Tomcat 5.5
>            Reporter: Nianhua Li
>            Assignee: Benson Margulies
>             Fix For: 2.0.3
>
>
> I am using the java-first approach with spring configuration on cxf 2.0.3 and tomcat 5.5. I specified namespace for all the input and output parameters via @WebParam and @WebResult annotation. But the namespace was somehow missing from the SOAP message.
> You can reproduce the problem by using the following test code (server side):
> =================web.xml========================================
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <!DOCTYPE web-app
>     PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
>     "http://java.sun.com/dtd/web-app_2_3.dtd">
> <web-app>
> 	<context-param>
> 		<param-name>contextConfigLocation</param-name>
> 		<param-value>WEB-INF/beans.xml</param-value>
> 	</context-param>
> 	<listener>
> 		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
> 	</listener>
> 	<servlet>
> 		<servlet-name>CXFServlet</servlet-name>
> 		<display-name>CXF Servlet</display-name>
> 		<servlet-class>
> 			org.apache.cxf.transport.servlet.CXFServlet
> 		</servlet-class>
> 		<load-on-startup>1</load-on-startup>
> 	</servlet>
> 	<servlet-mapping>
> 		<servlet-name>CXFServlet</servlet-name>
> 		<url-pattern>/*</url-pattern>
> 	</servlet-mapping>
> </web-app>
> ---------------------------------------------------------------------------------------------------------------
> =================beans.xml=======================================
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 	xmlns:jaxws="http://cxf.apache.org/jaxws"
> 	xmlns:cxf="http://cxf.apache.org/core"
> 	xsi:schemaLocation="
> http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
> http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
> http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
> 	<import resource="classpath:META-INF/cxf/cxf.xml" />
> 	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
> 	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
>     <bean id="logInbound" class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
>     <bean id="logOutbound" class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
>     <cxf:bus>
>         <cxf:inInterceptors> <ref bean="logInbound"/>  </cxf:inInterceptors>
>         <cxf:outInterceptors> <ref bean="logOutbound"/> </cxf:outInterceptors>
>         <cxf:inFaultInterceptors>  <ref bean="logOutbound"/>  </cxf:inFaultInterceptors>
>     </cxf:bus> 
>     <jaxws:endpoint   id="helloWorld"  implementor="demo.spring.HelloWorldImpl" 	  address="/HelloWorld" />
> </beans>
> -----------------------------------------------------------------------------------------------------------------------
> =================HelloWorld.java=======================================
> package demo.spring;
> import javax.jws.WebService;
> import javax.jws.WebMethod;
> import javax.jws.WebParam;
> import javax.jws.WebResult;
> import javax.xml.ws.ResponseWrapper;
> import javax.xml.ws.RequestWrapper;
> import javax.jws.soap.SOAPBinding;
> @WebService(name="MyHelloWorldService", targetNamespace="http://nstest.helloworld")
> @SOAPBinding(	parameterStyle=SOAPBinding.ParameterStyle.WRAPPED,
> 				style=SOAPBinding.Style.DOCUMENT,
> 				use= SOAPBinding.Use.LITERAL	)
> public interface HelloWorld {
> 	@WebMethod
> 	@WebResult(name="MyResult", targetNamespace="http://nstest.helloworld")
>     String sayHi(@WebParam(name="MyInput", targetNamespace="http://nstest.helloworld") String text);
> }
> -----------------------------------------------------------------------------------------------------------------------
> =================HelloWorldImpl.java=======================================
> package demo.spring;
> import javax.jws.WebService;
> import javax.jws.soap.SOAPBinding;
> @WebService(endpointInterface = "demo.spring.HelloWorld")
> public class HelloWorldImpl implements HelloWorld {
>     public String sayHi(String text) {
>         return "Hello " + text;
>     }
> }
> -----------------------------------------------------------------------------------------------------------------------
> Create WAR from the above code, deploy to tomcat, here is the WSDL I got from http://localhost:8080/...::
> =======main WSDL: http://localhost:8080/spring_http/HelloWorld?wsdl=================
> <?xml version="1.0" encoding="utf-8" ?> 
> - <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://nstest.helloworld" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://spring.demo/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="HelloWorldImplService" targetNamespace="http://spring.demo/">
>   <wsdl:import location="http://localhost:8080/spring_http/HelloWorld?wsdl=MyHelloWorldService.wsdl" namespace="http://nstest.helloworld" /> 
> - <wsdl:binding name="HelloWorldImplServiceSoapBinding" type="ns1:MyHelloWorldService">
>   <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> 
> - <wsdl:operation name="sayHi">
>   <soap:operation soapAction="" style="document" /> 
> - <wsdl:input name="sayHi">
>   <soap:body use="literal" /> 
>   </wsdl:input>
> - <wsdl:output name="sayHiResponse">
>   <soap:body use="literal" /> 
>   </wsdl:output>
>   </wsdl:operation>
>   </wsdl:binding>
> - <wsdl:service name="HelloWorldImplService">
> - <wsdl:port binding="tns:HelloWorldImplServiceSoapBinding" name="HelloWorldImplPort">
>   <soap:address location="http://localhost:8080/spring_http/HelloWorld" /> 
>   </wsdl:port>
>   </wsdl:service>
>   </wsdl:definitions>
> -----------------------------------------------------------------------------------------------------------------------------------------------
> =====imported WSDL: http://localhost:8080/spring_http/HelloWorld?wsdl=MyHelloWorldService.wsdl====
> <?xml version="1.0" encoding="utf-8" ?> 
> - <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://nstest.helloworld" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="MyHelloWorldService" targetNamespace="http://nstest.helloworld">
> - <wsdl:types>
> - <xsd:schema xmlns="http://nstest.helloworld" xmlns:tns="http://spring.demo/" attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://nstest.helloworld" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>   <import xmlns="http://www.w3.org/2001/XMLSchema" namespace="http://spring.demo/" /> 
>   <xsd:element name="sayHi" type="sayHi" /> 
> - <xsd:complexType name="sayHi">
> - <xsd:sequence>
>   <xsd:element minOccurs="0" name="MyInput" type="xsd:string" /> 
>   </xsd:sequence>
>   </xsd:complexType>
>   <xsd:element name="sayHiResponse" type="sayHiResponse" /> 
> - <xsd:complexType name="sayHiResponse">
> - <xsd:sequence>
>   <xsd:element minOccurs="0" name="MyResult" type="xsd:string" /> 
>   </xsd:sequence>
>   </xsd:complexType>
>   </xsd:schema>
>   </wsdl:types>
> - <wsdl:message name="sayHi">
>   <wsdl:part element="ns1:sayHi" name="parameters" /> 
>   </wsdl:message>
> - <wsdl:message name="sayHiResponse">
>   <wsdl:part element="ns1:sayHiResponse" name="parameters" /> 
>   </wsdl:message>
> - <wsdl:portType name="MyHelloWorldService">
> - <wsdl:operation name="sayHi">
>   <wsdl:input message="ns1:sayHi" name="sayHi" /> 
>   <wsdl:output message="ns1:sayHiResponse" name="sayHiResponse" /> 
>   </wsdl:operation>
>   </wsdl:portType>
>   </wsdl:definitions>
> -------------------------------------------------------------------------------------------------------------------------------------------
> Create client from WSDL by using wsdl2java. The namespaces of input/output parameters have already been missing from the generated service interface:
> ================MyHelloWorldService.java (generated by wsdl2java)====================== 
> package helloworld.nstest;
> import javax.jws.WebParam.Mode;
> import javax.jws.WebParam;
> import javax.jws.WebService;
> import javax.jws.soap.SOAPBinding.Style;
> import javax.jws.soap.SOAPBinding;
> import javax.jws.WebMethod;
> import javax.jws.WebResult;
> import javax.xml.ws.RequestWrapper;
> import javax.xml.ws.ResponseWrapper;
> /**
>  * This class was generated by Apache CXF (incubator) 2.0.3-incubator
>  * Tue Nov 20 22:45:47 EST 2007
>  * Generated source version: 2.0.3-incubator
>  * 
>  */
> @WebService(targetNamespace = "http://nstest.helloworld", name = "MyHelloWorldService")
> public interface MyHelloWorldService {
>     @ResponseWrapper(targetNamespace = "http://nstest.helloworld", className = "helloworld.nstest.SayHiResponse", localName = "sayHiResponse")
>     @RequestWrapper(targetNamespace = "http://nstest.helloworld", className = "helloworld.nstest.SayHi", localName = "sayHi")
>     @WebResult(targetNamespace = "", name = "MyResult")
>     @WebMethod
>     public java.lang.String sayHi(
>         @WebParam(targetNamespace = "", name = "MyInput")
>         java.lang.String myInput
>     );
> }
> ===================================================================
> Modify the generated client:
> ========MyHelloWorldService_HelloWorldImplPort_Client.java (generated by wsdl2java)======
> package helloworld.nstest;
> import java.io.File;
> import java.net.MalformedURLException;
> import java.net.URL;
> import javax.xml.namespace.QName;
> import demo.spring.HelloWorldImplService;
> import javax.jws.WebMethod;
> import javax.jws.WebResult;
> import javax.xml.ws.RequestWrapper;
> import javax.xml.ws.ResponseWrapper;
> public final class MyHelloWorldService_HelloWorldImplPort_Client {
>     private static final QName SERVICE_NAME = new QName("http://spring.demo/", "HelloWorldImplService");
>     private MyHelloWorldService_HelloWorldImplPort_Client() {
>     }
>     public static void main(String args[]) throws Exception {
>       
>         HelloWorldImplService ss = new HelloWorldImplService();
>         MyHelloWorldService port = ss.getHelloWorldImplPort();     
>         {
>         System.out.println("Invoking sayHi...");
>         java.lang.String _sayHi_myInput = "ABC";
>         java.lang.String _sayHi__return = port.sayHi(_sayHi_myInput);
>         System.out.println("sayHi.result=" + _sayHi__return);
>         }
>         System.exit(0);
>     }
> }
> --------------------------------------------------------------------------------------------------------
> SOAP message captured on server-side:
> --------------------------------------
> Encoding: UTF-8
> Headers: {connection=[keep-alive], cache-control=[no-cache], host=[localhost:808
> 0], user-agent=[Java/1.5.0_12], transfer-encoding=[chunked], pragma=[no-cache],
> content-type=[text/xml; charset=UTF-8], accept=[*], soapaction=[""]}
> Message:
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body
> ><ns2:sayHi xmlns:ns2="http://nstest.helloworld"><MyInput>ABC</MyInput></ns2:say
> Hi></soap:Body></soap:Envelope>
> --------------------------------------
> Nov 20, 2007 10:51:13 PM org.apache.cxf.interceptor.LoggingOutInterceptor$Loggin
> gCallback onClose
> INFO: Outbound Message:
> --------------------------------------
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body
> ><ns1:sayHiResponse xmlns:ns1="http://nstest.helloworld"><MyResult>Hello ABC</My
> Result></ns1:sayHiResponse></soap:Body></soap:Envelope>-------------------------
> -------------
> You can see that both "MyInput" and "MyResult" have no namespace.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-1226) Missing input/output param namespace in SOAP

Posted by "Benson Margulies (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-1226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12545505 ] 

Benson Margulies commented on CXF-1226:
---------------------------------------

I've checked in a test case for this in systests as org.apache.cxf.cxf1226. If JAXWS should respect package-info.java for the target namespace of an SEI, then this is a bug. If not, the submitted needs more advice from us.



> Missing input/output param namespace in SOAP
> --------------------------------------------
>
>                 Key: CXF-1226
>                 URL: https://issues.apache.org/jira/browse/CXF-1226
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.0.2, 2.0.3
>         Environment: Windows XP; Tomcat 5.5
>            Reporter: Nianhua Li
>            Assignee: Benson Margulies
>             Fix For: 2.0.3
>
>
> I am using the java-first approach with spring configuration on cxf 2.0.3 and tomcat 5.5. I specified namespace for all the input and output parameters via @WebParam and @WebResult annotation. But the namespace was somehow missing from the SOAP message.
> You can reproduce the problem by using the following test code (server side):
> =================web.xml========================================
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <!DOCTYPE web-app
>     PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
>     "http://java.sun.com/dtd/web-app_2_3.dtd">
> <web-app>
> 	<context-param>
> 		<param-name>contextConfigLocation</param-name>
> 		<param-value>WEB-INF/beans.xml</param-value>
> 	</context-param>
> 	<listener>
> 		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
> 	</listener>
> 	<servlet>
> 		<servlet-name>CXFServlet</servlet-name>
> 		<display-name>CXF Servlet</display-name>
> 		<servlet-class>
> 			org.apache.cxf.transport.servlet.CXFServlet
> 		</servlet-class>
> 		<load-on-startup>1</load-on-startup>
> 	</servlet>
> 	<servlet-mapping>
> 		<servlet-name>CXFServlet</servlet-name>
> 		<url-pattern>/*</url-pattern>
> 	</servlet-mapping>
> </web-app>
> ---------------------------------------------------------------------------------------------------------------
> =================beans.xml=======================================
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 	xmlns:jaxws="http://cxf.apache.org/jaxws"
> 	xmlns:cxf="http://cxf.apache.org/core"
> 	xsi:schemaLocation="
> http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
> http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
> http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
> 	<import resource="classpath:META-INF/cxf/cxf.xml" />
> 	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
> 	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
>     <bean id="logInbound" class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
>     <bean id="logOutbound" class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
>     <cxf:bus>
>         <cxf:inInterceptors> <ref bean="logInbound"/>  </cxf:inInterceptors>
>         <cxf:outInterceptors> <ref bean="logOutbound"/> </cxf:outInterceptors>
>         <cxf:inFaultInterceptors>  <ref bean="logOutbound"/>  </cxf:inFaultInterceptors>
>     </cxf:bus> 
>     <jaxws:endpoint   id="helloWorld"  implementor="demo.spring.HelloWorldImpl" 	  address="/HelloWorld" />
> </beans>
> -----------------------------------------------------------------------------------------------------------------------
> =================HelloWorld.java=======================================
> package demo.spring;
> import javax.jws.WebService;
> import javax.jws.WebMethod;
> import javax.jws.WebParam;
> import javax.jws.WebResult;
> import javax.xml.ws.ResponseWrapper;
> import javax.xml.ws.RequestWrapper;
> import javax.jws.soap.SOAPBinding;
> @WebService(name="MyHelloWorldService", targetNamespace="http://nstest.helloworld")
> @SOAPBinding(	parameterStyle=SOAPBinding.ParameterStyle.WRAPPED,
> 				style=SOAPBinding.Style.DOCUMENT,
> 				use= SOAPBinding.Use.LITERAL	)
> public interface HelloWorld {
> 	@WebMethod
> 	@WebResult(name="MyResult", targetNamespace="http://nstest.helloworld")
>     String sayHi(@WebParam(name="MyInput", targetNamespace="http://nstest.helloworld") String text);
> }
> -----------------------------------------------------------------------------------------------------------------------
> =================HelloWorldImpl.java=======================================
> package demo.spring;
> import javax.jws.WebService;
> import javax.jws.soap.SOAPBinding;
> @WebService(endpointInterface = "demo.spring.HelloWorld")
> public class HelloWorldImpl implements HelloWorld {
>     public String sayHi(String text) {
>         return "Hello " + text;
>     }
> }
> -----------------------------------------------------------------------------------------------------------------------
> Create WAR from the above code, deploy to tomcat, here is the WSDL I got from http://localhost:8080/...::
> =======main WSDL: http://localhost:8080/spring_http/HelloWorld?wsdl=================
> <?xml version="1.0" encoding="utf-8" ?> 
> - <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://nstest.helloworld" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://spring.demo/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="HelloWorldImplService" targetNamespace="http://spring.demo/">
>   <wsdl:import location="http://localhost:8080/spring_http/HelloWorld?wsdl=MyHelloWorldService.wsdl" namespace="http://nstest.helloworld" /> 
> - <wsdl:binding name="HelloWorldImplServiceSoapBinding" type="ns1:MyHelloWorldService">
>   <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> 
> - <wsdl:operation name="sayHi">
>   <soap:operation soapAction="" style="document" /> 
> - <wsdl:input name="sayHi">
>   <soap:body use="literal" /> 
>   </wsdl:input>
> - <wsdl:output name="sayHiResponse">
>   <soap:body use="literal" /> 
>   </wsdl:output>
>   </wsdl:operation>
>   </wsdl:binding>
> - <wsdl:service name="HelloWorldImplService">
> - <wsdl:port binding="tns:HelloWorldImplServiceSoapBinding" name="HelloWorldImplPort">
>   <soap:address location="http://localhost:8080/spring_http/HelloWorld" /> 
>   </wsdl:port>
>   </wsdl:service>
>   </wsdl:definitions>
> -----------------------------------------------------------------------------------------------------------------------------------------------
> =====imported WSDL: http://localhost:8080/spring_http/HelloWorld?wsdl=MyHelloWorldService.wsdl====
> <?xml version="1.0" encoding="utf-8" ?> 
> - <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://nstest.helloworld" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="MyHelloWorldService" targetNamespace="http://nstest.helloworld">
> - <wsdl:types>
> - <xsd:schema xmlns="http://nstest.helloworld" xmlns:tns="http://spring.demo/" attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://nstest.helloworld" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>   <import xmlns="http://www.w3.org/2001/XMLSchema" namespace="http://spring.demo/" /> 
>   <xsd:element name="sayHi" type="sayHi" /> 
> - <xsd:complexType name="sayHi">
> - <xsd:sequence>
>   <xsd:element minOccurs="0" name="MyInput" type="xsd:string" /> 
>   </xsd:sequence>
>   </xsd:complexType>
>   <xsd:element name="sayHiResponse" type="sayHiResponse" /> 
> - <xsd:complexType name="sayHiResponse">
> - <xsd:sequence>
>   <xsd:element minOccurs="0" name="MyResult" type="xsd:string" /> 
>   </xsd:sequence>
>   </xsd:complexType>
>   </xsd:schema>
>   </wsdl:types>
> - <wsdl:message name="sayHi">
>   <wsdl:part element="ns1:sayHi" name="parameters" /> 
>   </wsdl:message>
> - <wsdl:message name="sayHiResponse">
>   <wsdl:part element="ns1:sayHiResponse" name="parameters" /> 
>   </wsdl:message>
> - <wsdl:portType name="MyHelloWorldService">
> - <wsdl:operation name="sayHi">
>   <wsdl:input message="ns1:sayHi" name="sayHi" /> 
>   <wsdl:output message="ns1:sayHiResponse" name="sayHiResponse" /> 
>   </wsdl:operation>
>   </wsdl:portType>
>   </wsdl:definitions>
> -------------------------------------------------------------------------------------------------------------------------------------------
> Create client from WSDL by using wsdl2java. The namespaces of input/output parameters have already been missing from the generated service interface:
> ================MyHelloWorldService.java (generated by wsdl2java)====================== 
> package helloworld.nstest;
> import javax.jws.WebParam.Mode;
> import javax.jws.WebParam;
> import javax.jws.WebService;
> import javax.jws.soap.SOAPBinding.Style;
> import javax.jws.soap.SOAPBinding;
> import javax.jws.WebMethod;
> import javax.jws.WebResult;
> import javax.xml.ws.RequestWrapper;
> import javax.xml.ws.ResponseWrapper;
> /**
>  * This class was generated by Apache CXF (incubator) 2.0.3-incubator
>  * Tue Nov 20 22:45:47 EST 2007
>  * Generated source version: 2.0.3-incubator
>  * 
>  */
> @WebService(targetNamespace = "http://nstest.helloworld", name = "MyHelloWorldService")
> public interface MyHelloWorldService {
>     @ResponseWrapper(targetNamespace = "http://nstest.helloworld", className = "helloworld.nstest.SayHiResponse", localName = "sayHiResponse")
>     @RequestWrapper(targetNamespace = "http://nstest.helloworld", className = "helloworld.nstest.SayHi", localName = "sayHi")
>     @WebResult(targetNamespace = "", name = "MyResult")
>     @WebMethod
>     public java.lang.String sayHi(
>         @WebParam(targetNamespace = "", name = "MyInput")
>         java.lang.String myInput
>     );
> }
> ===================================================================
> Modify the generated client:
> ========MyHelloWorldService_HelloWorldImplPort_Client.java (generated by wsdl2java)======
> package helloworld.nstest;
> import java.io.File;
> import java.net.MalformedURLException;
> import java.net.URL;
> import javax.xml.namespace.QName;
> import demo.spring.HelloWorldImplService;
> import javax.jws.WebMethod;
> import javax.jws.WebResult;
> import javax.xml.ws.RequestWrapper;
> import javax.xml.ws.ResponseWrapper;
> public final class MyHelloWorldService_HelloWorldImplPort_Client {
>     private static final QName SERVICE_NAME = new QName("http://spring.demo/", "HelloWorldImplService");
>     private MyHelloWorldService_HelloWorldImplPort_Client() {
>     }
>     public static void main(String args[]) throws Exception {
>       
>         HelloWorldImplService ss = new HelloWorldImplService();
>         MyHelloWorldService port = ss.getHelloWorldImplPort();     
>         {
>         System.out.println("Invoking sayHi...");
>         java.lang.String _sayHi_myInput = "ABC";
>         java.lang.String _sayHi__return = port.sayHi(_sayHi_myInput);
>         System.out.println("sayHi.result=" + _sayHi__return);
>         }
>         System.exit(0);
>     }
> }
> --------------------------------------------------------------------------------------------------------
> SOAP message captured on server-side:
> --------------------------------------
> Encoding: UTF-8
> Headers: {connection=[keep-alive], cache-control=[no-cache], host=[localhost:808
> 0], user-agent=[Java/1.5.0_12], transfer-encoding=[chunked], pragma=[no-cache],
> content-type=[text/xml; charset=UTF-8], accept=[*], soapaction=[""]}
> Message:
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body
> ><ns2:sayHi xmlns:ns2="http://nstest.helloworld"><MyInput>ABC</MyInput></ns2:say
> Hi></soap:Body></soap:Envelope>
> --------------------------------------
> Nov 20, 2007 10:51:13 PM org.apache.cxf.interceptor.LoggingOutInterceptor$Loggin
> gCallback onClose
> INFO: Outbound Message:
> --------------------------------------
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body
> ><ns1:sayHiResponse xmlns:ns1="http://nstest.helloworld"><MyResult>Hello ABC</My
> Result></ns1:sayHiResponse></soap:Body></soap:Envelope>-------------------------
> -------------
> You can see that both "MyInput" and "MyResult" have no namespace.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-1226) elementFormDefault from package-info.java ignored with JAXWS+JAXB when there are no beans

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-1226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12547238 ] 

Daniel Kulp commented on CXF-1226:
----------------------------------


This is definitely a JAX-WS spec/TCK issue.   The TCK basically requires us to make the schemas for the wrapper type unqualified.   We originaly had them qualified (to match xfire), but could not get the tck to pass.   

That said, with 2.0.3, there is a way to configure things in Spring config to make the schemas qualified.  It's not very well tested though.   The ReflectionServiceFactoryBean has a qualifiedSchemas attribute that can be set to true to have it generate the schemas as qualified.   Should look something like:


  <jaxws:server address="/jaxwsAndJaxb" 
    serviceClass="org.apache.cxf.authservice.AuthService"> 
    <jaxws:serviceBean> 
      <bean class="org.apache.cxf.authservice.AuthServiceImpl" /> 
    </jaxws:serviceBean> 
    <jaxws:serviceFactory> 
            <bean class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean"> 
            <property name="qualifyWrapperSchema" value="true"/> 
            </bean> 
    </jaxws:serviceFactory> 
   </jaxws:server> 

> elementFormDefault from package-info.java ignored with JAXWS+JAXB when there are no beans
> -----------------------------------------------------------------------------------------
>
>                 Key: CXF-1226
>                 URL: https://issues.apache.org/jira/browse/CXF-1226
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.0.2, 2.0.3
>         Environment: Windows XP; Tomcat 5.5
>            Reporter: Nianhua Li
>            Assignee: Benson Margulies
>             Fix For: 2.0.3
>
>
> I am using the java-first approach with spring configuration on cxf 2.0.3 and tomcat 5.5. I specified namespace for all the input and output parameters via @WebParam and @WebResult annotation. But the namespace was somehow missing from the SOAP message.
> You can reproduce the problem by using the following test code (server side):
> =================web.xml========================================
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <!DOCTYPE web-app
>     PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
>     "http://java.sun.com/dtd/web-app_2_3.dtd">
> <web-app>
> 	<context-param>
> 		<param-name>contextConfigLocation</param-name>
> 		<param-value>WEB-INF/beans.xml</param-value>
> 	</context-param>
> 	<listener>
> 		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
> 	</listener>
> 	<servlet>
> 		<servlet-name>CXFServlet</servlet-name>
> 		<display-name>CXF Servlet</display-name>
> 		<servlet-class>
> 			org.apache.cxf.transport.servlet.CXFServlet
> 		</servlet-class>
> 		<load-on-startup>1</load-on-startup>
> 	</servlet>
> 	<servlet-mapping>
> 		<servlet-name>CXFServlet</servlet-name>
> 		<url-pattern>/*</url-pattern>
> 	</servlet-mapping>
> </web-app>
> ---------------------------------------------------------------------------------------------------------------
> =================beans.xml=======================================
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 	xmlns:jaxws="http://cxf.apache.org/jaxws"
> 	xmlns:cxf="http://cxf.apache.org/core"
> 	xsi:schemaLocation="
> http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
> http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
> http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
> 	<import resource="classpath:META-INF/cxf/cxf.xml" />
> 	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
> 	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
>     <bean id="logInbound" class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
>     <bean id="logOutbound" class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
>     <cxf:bus>
>         <cxf:inInterceptors> <ref bean="logInbound"/>  </cxf:inInterceptors>
>         <cxf:outInterceptors> <ref bean="logOutbound"/> </cxf:outInterceptors>
>         <cxf:inFaultInterceptors>  <ref bean="logOutbound"/>  </cxf:inFaultInterceptors>
>     </cxf:bus> 
>     <jaxws:endpoint   id="helloWorld"  implementor="demo.spring.HelloWorldImpl" 	  address="/HelloWorld" />
> </beans>
> -----------------------------------------------------------------------------------------------------------------------
> =================HelloWorld.java=======================================
> package demo.spring;
> import javax.jws.WebService;
> import javax.jws.WebMethod;
> import javax.jws.WebParam;
> import javax.jws.WebResult;
> import javax.xml.ws.ResponseWrapper;
> import javax.xml.ws.RequestWrapper;
> import javax.jws.soap.SOAPBinding;
> @WebService(name="MyHelloWorldService", targetNamespace="http://nstest.helloworld")
> @SOAPBinding(	parameterStyle=SOAPBinding.ParameterStyle.WRAPPED,
> 				style=SOAPBinding.Style.DOCUMENT,
> 				use= SOAPBinding.Use.LITERAL	)
> public interface HelloWorld {
> 	@WebMethod
> 	@WebResult(name="MyResult", targetNamespace="http://nstest.helloworld")
>     String sayHi(@WebParam(name="MyInput", targetNamespace="http://nstest.helloworld") String text);
> }
> -----------------------------------------------------------------------------------------------------------------------
> =================HelloWorldImpl.java=======================================
> package demo.spring;
> import javax.jws.WebService;
> import javax.jws.soap.SOAPBinding;
> @WebService(endpointInterface = "demo.spring.HelloWorld")
> public class HelloWorldImpl implements HelloWorld {
>     public String sayHi(String text) {
>         return "Hello " + text;
>     }
> }
> -----------------------------------------------------------------------------------------------------------------------
> Create WAR from the above code, deploy to tomcat, here is the WSDL I got from http://localhost:8080/...::
> =======main WSDL: http://localhost:8080/spring_http/HelloWorld?wsdl=================
> <?xml version="1.0" encoding="utf-8" ?> 
> - <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://nstest.helloworld" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://spring.demo/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="HelloWorldImplService" targetNamespace="http://spring.demo/">
>   <wsdl:import location="http://localhost:8080/spring_http/HelloWorld?wsdl=MyHelloWorldService.wsdl" namespace="http://nstest.helloworld" /> 
> - <wsdl:binding name="HelloWorldImplServiceSoapBinding" type="ns1:MyHelloWorldService">
>   <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> 
> - <wsdl:operation name="sayHi">
>   <soap:operation soapAction="" style="document" /> 
> - <wsdl:input name="sayHi">
>   <soap:body use="literal" /> 
>   </wsdl:input>
> - <wsdl:output name="sayHiResponse">
>   <soap:body use="literal" /> 
>   </wsdl:output>
>   </wsdl:operation>
>   </wsdl:binding>
> - <wsdl:service name="HelloWorldImplService">
> - <wsdl:port binding="tns:HelloWorldImplServiceSoapBinding" name="HelloWorldImplPort">
>   <soap:address location="http://localhost:8080/spring_http/HelloWorld" /> 
>   </wsdl:port>
>   </wsdl:service>
>   </wsdl:definitions>
> -----------------------------------------------------------------------------------------------------------------------------------------------
> =====imported WSDL: http://localhost:8080/spring_http/HelloWorld?wsdl=MyHelloWorldService.wsdl====
> <?xml version="1.0" encoding="utf-8" ?> 
> - <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://nstest.helloworld" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="MyHelloWorldService" targetNamespace="http://nstest.helloworld">
> - <wsdl:types>
> - <xsd:schema xmlns="http://nstest.helloworld" xmlns:tns="http://spring.demo/" attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://nstest.helloworld" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>   <import xmlns="http://www.w3.org/2001/XMLSchema" namespace="http://spring.demo/" /> 
>   <xsd:element name="sayHi" type="sayHi" /> 
> - <xsd:complexType name="sayHi">
> - <xsd:sequence>
>   <xsd:element minOccurs="0" name="MyInput" type="xsd:string" /> 
>   </xsd:sequence>
>   </xsd:complexType>
>   <xsd:element name="sayHiResponse" type="sayHiResponse" /> 
> - <xsd:complexType name="sayHiResponse">
> - <xsd:sequence>
>   <xsd:element minOccurs="0" name="MyResult" type="xsd:string" /> 
>   </xsd:sequence>
>   </xsd:complexType>
>   </xsd:schema>
>   </wsdl:types>
> - <wsdl:message name="sayHi">
>   <wsdl:part element="ns1:sayHi" name="parameters" /> 
>   </wsdl:message>
> - <wsdl:message name="sayHiResponse">
>   <wsdl:part element="ns1:sayHiResponse" name="parameters" /> 
>   </wsdl:message>
> - <wsdl:portType name="MyHelloWorldService">
> - <wsdl:operation name="sayHi">
>   <wsdl:input message="ns1:sayHi" name="sayHi" /> 
>   <wsdl:output message="ns1:sayHiResponse" name="sayHiResponse" /> 
>   </wsdl:operation>
>   </wsdl:portType>
>   </wsdl:definitions>
> -------------------------------------------------------------------------------------------------------------------------------------------
> Create client from WSDL by using wsdl2java. The namespaces of input/output parameters have already been missing from the generated service interface:
> ================MyHelloWorldService.java (generated by wsdl2java)====================== 
> package helloworld.nstest;
> import javax.jws.WebParam.Mode;
> import javax.jws.WebParam;
> import javax.jws.WebService;
> import javax.jws.soap.SOAPBinding.Style;
> import javax.jws.soap.SOAPBinding;
> import javax.jws.WebMethod;
> import javax.jws.WebResult;
> import javax.xml.ws.RequestWrapper;
> import javax.xml.ws.ResponseWrapper;
> /**
>  * This class was generated by Apache CXF (incubator) 2.0.3-incubator
>  * Tue Nov 20 22:45:47 EST 2007
>  * Generated source version: 2.0.3-incubator
>  * 
>  */
> @WebService(targetNamespace = "http://nstest.helloworld", name = "MyHelloWorldService")
> public interface MyHelloWorldService {
>     @ResponseWrapper(targetNamespace = "http://nstest.helloworld", className = "helloworld.nstest.SayHiResponse", localName = "sayHiResponse")
>     @RequestWrapper(targetNamespace = "http://nstest.helloworld", className = "helloworld.nstest.SayHi", localName = "sayHi")
>     @WebResult(targetNamespace = "", name = "MyResult")
>     @WebMethod
>     public java.lang.String sayHi(
>         @WebParam(targetNamespace = "", name = "MyInput")
>         java.lang.String myInput
>     );
> }
> ===================================================================
> Modify the generated client:
> ========MyHelloWorldService_HelloWorldImplPort_Client.java (generated by wsdl2java)======
> package helloworld.nstest;
> import java.io.File;
> import java.net.MalformedURLException;
> import java.net.URL;
> import javax.xml.namespace.QName;
> import demo.spring.HelloWorldImplService;
> import javax.jws.WebMethod;
> import javax.jws.WebResult;
> import javax.xml.ws.RequestWrapper;
> import javax.xml.ws.ResponseWrapper;
> public final class MyHelloWorldService_HelloWorldImplPort_Client {
>     private static final QName SERVICE_NAME = new QName("http://spring.demo/", "HelloWorldImplService");
>     private MyHelloWorldService_HelloWorldImplPort_Client() {
>     }
>     public static void main(String args[]) throws Exception {
>       
>         HelloWorldImplService ss = new HelloWorldImplService();
>         MyHelloWorldService port = ss.getHelloWorldImplPort();     
>         {
>         System.out.println("Invoking sayHi...");
>         java.lang.String _sayHi_myInput = "ABC";
>         java.lang.String _sayHi__return = port.sayHi(_sayHi_myInput);
>         System.out.println("sayHi.result=" + _sayHi__return);
>         }
>         System.exit(0);
>     }
> }
> --------------------------------------------------------------------------------------------------------
> SOAP message captured on server-side:
> --------------------------------------
> Encoding: UTF-8
> Headers: {connection=[keep-alive], cache-control=[no-cache], host=[localhost:808
> 0], user-agent=[Java/1.5.0_12], transfer-encoding=[chunked], pragma=[no-cache],
> content-type=[text/xml; charset=UTF-8], accept=[*], soapaction=[""]}
> Message:
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body
> ><ns2:sayHi xmlns:ns2="http://nstest.helloworld"><MyInput>ABC</MyInput></ns2:say
> Hi></soap:Body></soap:Envelope>
> --------------------------------------
> Nov 20, 2007 10:51:13 PM org.apache.cxf.interceptor.LoggingOutInterceptor$Loggin
> gCallback onClose
> INFO: Outbound Message:
> --------------------------------------
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body
> ><ns1:sayHiResponse xmlns:ns1="http://nstest.helloworld"><MyResult>Hello ABC</My
> Result></ns1:sayHiResponse></soap:Body></soap:Envelope>-------------------------
> -------------
> You can see that both "MyInput" and "MyResult" have no namespace.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-1226) Missing input/output param namespace in SOAP

Posted by "Benson Margulies (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-1226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12545511 ] 

Benson Margulies commented on CXF-1226:
---------------------------------------

OK. I don't know if this is a bug or a feature, but ...

Since you are only dealing with basic types plus the SEI and implementation, JAXB isn't involved. You can get JAXB involved via two steps:

1) Add a package-info.java specifying elementFormDefault='qualified' for the namespace that you are using for these elements.

2) Add a method to your service that uses an object defined in the package where you put the package-info.java.

I haven't tested that the XML on the wire is as you want, but i have tested that elementForDefault gets sets to qualified.

I'm leaving this open until someone tells me if this is a bug or not that the package-info.java is ignored without the bean.


> Missing input/output param namespace in SOAP
> --------------------------------------------
>
>                 Key: CXF-1226
>                 URL: https://issues.apache.org/jira/browse/CXF-1226
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.0.2, 2.0.3
>         Environment: Windows XP; Tomcat 5.5
>            Reporter: Nianhua Li
>            Assignee: Benson Margulies
>             Fix For: 2.0.3
>
>
> I am using the java-first approach with spring configuration on cxf 2.0.3 and tomcat 5.5. I specified namespace for all the input and output parameters via @WebParam and @WebResult annotation. But the namespace was somehow missing from the SOAP message.
> You can reproduce the problem by using the following test code (server side):
> =================web.xml========================================
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <!DOCTYPE web-app
>     PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
>     "http://java.sun.com/dtd/web-app_2_3.dtd">
> <web-app>
> 	<context-param>
> 		<param-name>contextConfigLocation</param-name>
> 		<param-value>WEB-INF/beans.xml</param-value>
> 	</context-param>
> 	<listener>
> 		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
> 	</listener>
> 	<servlet>
> 		<servlet-name>CXFServlet</servlet-name>
> 		<display-name>CXF Servlet</display-name>
> 		<servlet-class>
> 			org.apache.cxf.transport.servlet.CXFServlet
> 		</servlet-class>
> 		<load-on-startup>1</load-on-startup>
> 	</servlet>
> 	<servlet-mapping>
> 		<servlet-name>CXFServlet</servlet-name>
> 		<url-pattern>/*</url-pattern>
> 	</servlet-mapping>
> </web-app>
> ---------------------------------------------------------------------------------------------------------------
> =================beans.xml=======================================
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 	xmlns:jaxws="http://cxf.apache.org/jaxws"
> 	xmlns:cxf="http://cxf.apache.org/core"
> 	xsi:schemaLocation="
> http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
> http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
> http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
> 	<import resource="classpath:META-INF/cxf/cxf.xml" />
> 	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
> 	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
>     <bean id="logInbound" class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
>     <bean id="logOutbound" class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
>     <cxf:bus>
>         <cxf:inInterceptors> <ref bean="logInbound"/>  </cxf:inInterceptors>
>         <cxf:outInterceptors> <ref bean="logOutbound"/> </cxf:outInterceptors>
>         <cxf:inFaultInterceptors>  <ref bean="logOutbound"/>  </cxf:inFaultInterceptors>
>     </cxf:bus> 
>     <jaxws:endpoint   id="helloWorld"  implementor="demo.spring.HelloWorldImpl" 	  address="/HelloWorld" />
> </beans>
> -----------------------------------------------------------------------------------------------------------------------
> =================HelloWorld.java=======================================
> package demo.spring;
> import javax.jws.WebService;
> import javax.jws.WebMethod;
> import javax.jws.WebParam;
> import javax.jws.WebResult;
> import javax.xml.ws.ResponseWrapper;
> import javax.xml.ws.RequestWrapper;
> import javax.jws.soap.SOAPBinding;
> @WebService(name="MyHelloWorldService", targetNamespace="http://nstest.helloworld")
> @SOAPBinding(	parameterStyle=SOAPBinding.ParameterStyle.WRAPPED,
> 				style=SOAPBinding.Style.DOCUMENT,
> 				use= SOAPBinding.Use.LITERAL	)
> public interface HelloWorld {
> 	@WebMethod
> 	@WebResult(name="MyResult", targetNamespace="http://nstest.helloworld")
>     String sayHi(@WebParam(name="MyInput", targetNamespace="http://nstest.helloworld") String text);
> }
> -----------------------------------------------------------------------------------------------------------------------
> =================HelloWorldImpl.java=======================================
> package demo.spring;
> import javax.jws.WebService;
> import javax.jws.soap.SOAPBinding;
> @WebService(endpointInterface = "demo.spring.HelloWorld")
> public class HelloWorldImpl implements HelloWorld {
>     public String sayHi(String text) {
>         return "Hello " + text;
>     }
> }
> -----------------------------------------------------------------------------------------------------------------------
> Create WAR from the above code, deploy to tomcat, here is the WSDL I got from http://localhost:8080/...::
> =======main WSDL: http://localhost:8080/spring_http/HelloWorld?wsdl=================
> <?xml version="1.0" encoding="utf-8" ?> 
> - <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://nstest.helloworld" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://spring.demo/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="HelloWorldImplService" targetNamespace="http://spring.demo/">
>   <wsdl:import location="http://localhost:8080/spring_http/HelloWorld?wsdl=MyHelloWorldService.wsdl" namespace="http://nstest.helloworld" /> 
> - <wsdl:binding name="HelloWorldImplServiceSoapBinding" type="ns1:MyHelloWorldService">
>   <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> 
> - <wsdl:operation name="sayHi">
>   <soap:operation soapAction="" style="document" /> 
> - <wsdl:input name="sayHi">
>   <soap:body use="literal" /> 
>   </wsdl:input>
> - <wsdl:output name="sayHiResponse">
>   <soap:body use="literal" /> 
>   </wsdl:output>
>   </wsdl:operation>
>   </wsdl:binding>
> - <wsdl:service name="HelloWorldImplService">
> - <wsdl:port binding="tns:HelloWorldImplServiceSoapBinding" name="HelloWorldImplPort">
>   <soap:address location="http://localhost:8080/spring_http/HelloWorld" /> 
>   </wsdl:port>
>   </wsdl:service>
>   </wsdl:definitions>
> -----------------------------------------------------------------------------------------------------------------------------------------------
> =====imported WSDL: http://localhost:8080/spring_http/HelloWorld?wsdl=MyHelloWorldService.wsdl====
> <?xml version="1.0" encoding="utf-8" ?> 
> - <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://nstest.helloworld" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="MyHelloWorldService" targetNamespace="http://nstest.helloworld">
> - <wsdl:types>
> - <xsd:schema xmlns="http://nstest.helloworld" xmlns:tns="http://spring.demo/" attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://nstest.helloworld" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>   <import xmlns="http://www.w3.org/2001/XMLSchema" namespace="http://spring.demo/" /> 
>   <xsd:element name="sayHi" type="sayHi" /> 
> - <xsd:complexType name="sayHi">
> - <xsd:sequence>
>   <xsd:element minOccurs="0" name="MyInput" type="xsd:string" /> 
>   </xsd:sequence>
>   </xsd:complexType>
>   <xsd:element name="sayHiResponse" type="sayHiResponse" /> 
> - <xsd:complexType name="sayHiResponse">
> - <xsd:sequence>
>   <xsd:element minOccurs="0" name="MyResult" type="xsd:string" /> 
>   </xsd:sequence>
>   </xsd:complexType>
>   </xsd:schema>
>   </wsdl:types>
> - <wsdl:message name="sayHi">
>   <wsdl:part element="ns1:sayHi" name="parameters" /> 
>   </wsdl:message>
> - <wsdl:message name="sayHiResponse">
>   <wsdl:part element="ns1:sayHiResponse" name="parameters" /> 
>   </wsdl:message>
> - <wsdl:portType name="MyHelloWorldService">
> - <wsdl:operation name="sayHi">
>   <wsdl:input message="ns1:sayHi" name="sayHi" /> 
>   <wsdl:output message="ns1:sayHiResponse" name="sayHiResponse" /> 
>   </wsdl:operation>
>   </wsdl:portType>
>   </wsdl:definitions>
> -------------------------------------------------------------------------------------------------------------------------------------------
> Create client from WSDL by using wsdl2java. The namespaces of input/output parameters have already been missing from the generated service interface:
> ================MyHelloWorldService.java (generated by wsdl2java)====================== 
> package helloworld.nstest;
> import javax.jws.WebParam.Mode;
> import javax.jws.WebParam;
> import javax.jws.WebService;
> import javax.jws.soap.SOAPBinding.Style;
> import javax.jws.soap.SOAPBinding;
> import javax.jws.WebMethod;
> import javax.jws.WebResult;
> import javax.xml.ws.RequestWrapper;
> import javax.xml.ws.ResponseWrapper;
> /**
>  * This class was generated by Apache CXF (incubator) 2.0.3-incubator
>  * Tue Nov 20 22:45:47 EST 2007
>  * Generated source version: 2.0.3-incubator
>  * 
>  */
> @WebService(targetNamespace = "http://nstest.helloworld", name = "MyHelloWorldService")
> public interface MyHelloWorldService {
>     @ResponseWrapper(targetNamespace = "http://nstest.helloworld", className = "helloworld.nstest.SayHiResponse", localName = "sayHiResponse")
>     @RequestWrapper(targetNamespace = "http://nstest.helloworld", className = "helloworld.nstest.SayHi", localName = "sayHi")
>     @WebResult(targetNamespace = "", name = "MyResult")
>     @WebMethod
>     public java.lang.String sayHi(
>         @WebParam(targetNamespace = "", name = "MyInput")
>         java.lang.String myInput
>     );
> }
> ===================================================================
> Modify the generated client:
> ========MyHelloWorldService_HelloWorldImplPort_Client.java (generated by wsdl2java)======
> package helloworld.nstest;
> import java.io.File;
> import java.net.MalformedURLException;
> import java.net.URL;
> import javax.xml.namespace.QName;
> import demo.spring.HelloWorldImplService;
> import javax.jws.WebMethod;
> import javax.jws.WebResult;
> import javax.xml.ws.RequestWrapper;
> import javax.xml.ws.ResponseWrapper;
> public final class MyHelloWorldService_HelloWorldImplPort_Client {
>     private static final QName SERVICE_NAME = new QName("http://spring.demo/", "HelloWorldImplService");
>     private MyHelloWorldService_HelloWorldImplPort_Client() {
>     }
>     public static void main(String args[]) throws Exception {
>       
>         HelloWorldImplService ss = new HelloWorldImplService();
>         MyHelloWorldService port = ss.getHelloWorldImplPort();     
>         {
>         System.out.println("Invoking sayHi...");
>         java.lang.String _sayHi_myInput = "ABC";
>         java.lang.String _sayHi__return = port.sayHi(_sayHi_myInput);
>         System.out.println("sayHi.result=" + _sayHi__return);
>         }
>         System.exit(0);
>     }
> }
> --------------------------------------------------------------------------------------------------------
> SOAP message captured on server-side:
> --------------------------------------
> Encoding: UTF-8
> Headers: {connection=[keep-alive], cache-control=[no-cache], host=[localhost:808
> 0], user-agent=[Java/1.5.0_12], transfer-encoding=[chunked], pragma=[no-cache],
> content-type=[text/xml; charset=UTF-8], accept=[*], soapaction=[""]}
> Message:
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body
> ><ns2:sayHi xmlns:ns2="http://nstest.helloworld"><MyInput>ABC</MyInput></ns2:say
> Hi></soap:Body></soap:Envelope>
> --------------------------------------
> Nov 20, 2007 10:51:13 PM org.apache.cxf.interceptor.LoggingOutInterceptor$Loggin
> gCallback onClose
> INFO: Outbound Message:
> --------------------------------------
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body
> ><ns1:sayHiResponse xmlns:ns1="http://nstest.helloworld"><MyResult>Hello ABC</My
> Result></ns1:sayHiResponse></soap:Body></soap:Envelope>-------------------------
> -------------
> You can see that both "MyInput" and "MyResult" have no namespace.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-1226) Missing input/output param namespace in SOAP

Posted by "Benson Margulies (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-1226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12545469 ] 

Benson Margulies commented on CXF-1226:
---------------------------------------

Oh dear. I read the generated code instead of your original code.

I will reopen this. 

I suggest that you try using targetNamespace= to put the SEI and the implementation in the same namespace. I don't claim that you should have to do this, but it might help while you wait for one of us to turn on our brains.


> Missing input/output param namespace in SOAP
> --------------------------------------------
>
>                 Key: CXF-1226
>                 URL: https://issues.apache.org/jira/browse/CXF-1226
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.0.2, 2.0.3
>         Environment: Windows XP; Tomcat 5.5
>            Reporter: Nianhua Li
>            Assignee: Benson Margulies
>             Fix For: 2.0.3
>
>
> I am using the java-first approach with spring configuration on cxf 2.0.3 and tomcat 5.5. I specified namespace for all the input and output parameters via @WebParam and @WebResult annotation. But the namespace was somehow missing from the SOAP message.
> You can reproduce the problem by using the following test code (server side):
> =================web.xml========================================
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <!DOCTYPE web-app
>     PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
>     "http://java.sun.com/dtd/web-app_2_3.dtd">
> <web-app>
> 	<context-param>
> 		<param-name>contextConfigLocation</param-name>
> 		<param-value>WEB-INF/beans.xml</param-value>
> 	</context-param>
> 	<listener>
> 		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
> 	</listener>
> 	<servlet>
> 		<servlet-name>CXFServlet</servlet-name>
> 		<display-name>CXF Servlet</display-name>
> 		<servlet-class>
> 			org.apache.cxf.transport.servlet.CXFServlet
> 		</servlet-class>
> 		<load-on-startup>1</load-on-startup>
> 	</servlet>
> 	<servlet-mapping>
> 		<servlet-name>CXFServlet</servlet-name>
> 		<url-pattern>/*</url-pattern>
> 	</servlet-mapping>
> </web-app>
> ---------------------------------------------------------------------------------------------------------------
> =================beans.xml=======================================
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 	xmlns:jaxws="http://cxf.apache.org/jaxws"
> 	xmlns:cxf="http://cxf.apache.org/core"
> 	xsi:schemaLocation="
> http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
> http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
> http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
> 	<import resource="classpath:META-INF/cxf/cxf.xml" />
> 	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
> 	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
>     <bean id="logInbound" class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
>     <bean id="logOutbound" class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
>     <cxf:bus>
>         <cxf:inInterceptors> <ref bean="logInbound"/>  </cxf:inInterceptors>
>         <cxf:outInterceptors> <ref bean="logOutbound"/> </cxf:outInterceptors>
>         <cxf:inFaultInterceptors>  <ref bean="logOutbound"/>  </cxf:inFaultInterceptors>
>     </cxf:bus> 
>     <jaxws:endpoint   id="helloWorld"  implementor="demo.spring.HelloWorldImpl" 	  address="/HelloWorld" />
> </beans>
> -----------------------------------------------------------------------------------------------------------------------
> =================HelloWorld.java=======================================
> package demo.spring;
> import javax.jws.WebService;
> import javax.jws.WebMethod;
> import javax.jws.WebParam;
> import javax.jws.WebResult;
> import javax.xml.ws.ResponseWrapper;
> import javax.xml.ws.RequestWrapper;
> import javax.jws.soap.SOAPBinding;
> @WebService(name="MyHelloWorldService", targetNamespace="http://nstest.helloworld")
> @SOAPBinding(	parameterStyle=SOAPBinding.ParameterStyle.WRAPPED,
> 				style=SOAPBinding.Style.DOCUMENT,
> 				use= SOAPBinding.Use.LITERAL	)
> public interface HelloWorld {
> 	@WebMethod
> 	@WebResult(name="MyResult", targetNamespace="http://nstest.helloworld")
>     String sayHi(@WebParam(name="MyInput", targetNamespace="http://nstest.helloworld") String text);
> }
> -----------------------------------------------------------------------------------------------------------------------
> =================HelloWorldImpl.java=======================================
> package demo.spring;
> import javax.jws.WebService;
> import javax.jws.soap.SOAPBinding;
> @WebService(endpointInterface = "demo.spring.HelloWorld")
> public class HelloWorldImpl implements HelloWorld {
>     public String sayHi(String text) {
>         return "Hello " + text;
>     }
> }
> -----------------------------------------------------------------------------------------------------------------------
> Create WAR from the above code, deploy to tomcat, here is the WSDL I got from http://localhost:8080/...::
> =======main WSDL: http://localhost:8080/spring_http/HelloWorld?wsdl=================
> <?xml version="1.0" encoding="utf-8" ?> 
> - <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://nstest.helloworld" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://spring.demo/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="HelloWorldImplService" targetNamespace="http://spring.demo/">
>   <wsdl:import location="http://localhost:8080/spring_http/HelloWorld?wsdl=MyHelloWorldService.wsdl" namespace="http://nstest.helloworld" /> 
> - <wsdl:binding name="HelloWorldImplServiceSoapBinding" type="ns1:MyHelloWorldService">
>   <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> 
> - <wsdl:operation name="sayHi">
>   <soap:operation soapAction="" style="document" /> 
> - <wsdl:input name="sayHi">
>   <soap:body use="literal" /> 
>   </wsdl:input>
> - <wsdl:output name="sayHiResponse">
>   <soap:body use="literal" /> 
>   </wsdl:output>
>   </wsdl:operation>
>   </wsdl:binding>
> - <wsdl:service name="HelloWorldImplService">
> - <wsdl:port binding="tns:HelloWorldImplServiceSoapBinding" name="HelloWorldImplPort">
>   <soap:address location="http://localhost:8080/spring_http/HelloWorld" /> 
>   </wsdl:port>
>   </wsdl:service>
>   </wsdl:definitions>
> -----------------------------------------------------------------------------------------------------------------------------------------------
> =====imported WSDL: http://localhost:8080/spring_http/HelloWorld?wsdl=MyHelloWorldService.wsdl====
> <?xml version="1.0" encoding="utf-8" ?> 
> - <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://nstest.helloworld" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="MyHelloWorldService" targetNamespace="http://nstest.helloworld">
> - <wsdl:types>
> - <xsd:schema xmlns="http://nstest.helloworld" xmlns:tns="http://spring.demo/" attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://nstest.helloworld" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>   <import xmlns="http://www.w3.org/2001/XMLSchema" namespace="http://spring.demo/" /> 
>   <xsd:element name="sayHi" type="sayHi" /> 
> - <xsd:complexType name="sayHi">
> - <xsd:sequence>
>   <xsd:element minOccurs="0" name="MyInput" type="xsd:string" /> 
>   </xsd:sequence>
>   </xsd:complexType>
>   <xsd:element name="sayHiResponse" type="sayHiResponse" /> 
> - <xsd:complexType name="sayHiResponse">
> - <xsd:sequence>
>   <xsd:element minOccurs="0" name="MyResult" type="xsd:string" /> 
>   </xsd:sequence>
>   </xsd:complexType>
>   </xsd:schema>
>   </wsdl:types>
> - <wsdl:message name="sayHi">
>   <wsdl:part element="ns1:sayHi" name="parameters" /> 
>   </wsdl:message>
> - <wsdl:message name="sayHiResponse">
>   <wsdl:part element="ns1:sayHiResponse" name="parameters" /> 
>   </wsdl:message>
> - <wsdl:portType name="MyHelloWorldService">
> - <wsdl:operation name="sayHi">
>   <wsdl:input message="ns1:sayHi" name="sayHi" /> 
>   <wsdl:output message="ns1:sayHiResponse" name="sayHiResponse" /> 
>   </wsdl:operation>
>   </wsdl:portType>
>   </wsdl:definitions>
> -------------------------------------------------------------------------------------------------------------------------------------------
> Create client from WSDL by using wsdl2java. The namespaces of input/output parameters have already been missing from the generated service interface:
> ================MyHelloWorldService.java (generated by wsdl2java)====================== 
> package helloworld.nstest;
> import javax.jws.WebParam.Mode;
> import javax.jws.WebParam;
> import javax.jws.WebService;
> import javax.jws.soap.SOAPBinding.Style;
> import javax.jws.soap.SOAPBinding;
> import javax.jws.WebMethod;
> import javax.jws.WebResult;
> import javax.xml.ws.RequestWrapper;
> import javax.xml.ws.ResponseWrapper;
> /**
>  * This class was generated by Apache CXF (incubator) 2.0.3-incubator
>  * Tue Nov 20 22:45:47 EST 2007
>  * Generated source version: 2.0.3-incubator
>  * 
>  */
> @WebService(targetNamespace = "http://nstest.helloworld", name = "MyHelloWorldService")
> public interface MyHelloWorldService {
>     @ResponseWrapper(targetNamespace = "http://nstest.helloworld", className = "helloworld.nstest.SayHiResponse", localName = "sayHiResponse")
>     @RequestWrapper(targetNamespace = "http://nstest.helloworld", className = "helloworld.nstest.SayHi", localName = "sayHi")
>     @WebResult(targetNamespace = "", name = "MyResult")
>     @WebMethod
>     public java.lang.String sayHi(
>         @WebParam(targetNamespace = "", name = "MyInput")
>         java.lang.String myInput
>     );
> }
> ===================================================================
> Modify the generated client:
> ========MyHelloWorldService_HelloWorldImplPort_Client.java (generated by wsdl2java)======
> package helloworld.nstest;
> import java.io.File;
> import java.net.MalformedURLException;
> import java.net.URL;
> import javax.xml.namespace.QName;
> import demo.spring.HelloWorldImplService;
> import javax.jws.WebMethod;
> import javax.jws.WebResult;
> import javax.xml.ws.RequestWrapper;
> import javax.xml.ws.ResponseWrapper;
> public final class MyHelloWorldService_HelloWorldImplPort_Client {
>     private static final QName SERVICE_NAME = new QName("http://spring.demo/", "HelloWorldImplService");
>     private MyHelloWorldService_HelloWorldImplPort_Client() {
>     }
>     public static void main(String args[]) throws Exception {
>       
>         HelloWorldImplService ss = new HelloWorldImplService();
>         MyHelloWorldService port = ss.getHelloWorldImplPort();     
>         {
>         System.out.println("Invoking sayHi...");
>         java.lang.String _sayHi_myInput = "ABC";
>         java.lang.String _sayHi__return = port.sayHi(_sayHi_myInput);
>         System.out.println("sayHi.result=" + _sayHi__return);
>         }
>         System.exit(0);
>     }
> }
> --------------------------------------------------------------------------------------------------------
> SOAP message captured on server-side:
> --------------------------------------
> Encoding: UTF-8
> Headers: {connection=[keep-alive], cache-control=[no-cache], host=[localhost:808
> 0], user-agent=[Java/1.5.0_12], transfer-encoding=[chunked], pragma=[no-cache],
> content-type=[text/xml; charset=UTF-8], accept=[*], soapaction=[""]}
> Message:
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body
> ><ns2:sayHi xmlns:ns2="http://nstest.helloworld"><MyInput>ABC</MyInput></ns2:say
> Hi></soap:Body></soap:Envelope>
> --------------------------------------
> Nov 20, 2007 10:51:13 PM org.apache.cxf.interceptor.LoggingOutInterceptor$Loggin
> gCallback onClose
> INFO: Outbound Message:
> --------------------------------------
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body
> ><ns1:sayHiResponse xmlns:ns1="http://nstest.helloworld"><MyResult>Hello ABC</My
> Result></ns1:sayHiResponse></soap:Body></soap:Envelope>-------------------------
> -------------
> You can see that both "MyInput" and "MyResult" have no namespace.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (CXF-1226) elementFormDefault from package-info.java ignored with JAXWS+JAXB when there are no beans

Posted by "Benson Margulies (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-1226?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Benson Margulies reassigned CXF-1226:
-------------------------------------

    Assignee: Daniel Kulp  (was: Benson Margulies)

Dan, if this is legit, please send it back to me. If this is just how life is with these dueling standards, let's close this out (and encourage the use of doc/bare?).

> elementFormDefault from package-info.java ignored with JAXWS+JAXB when there are no beans
> -----------------------------------------------------------------------------------------
>
>                 Key: CXF-1226
>                 URL: https://issues.apache.org/jira/browse/CXF-1226
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.0.2, 2.0.3
>         Environment: Windows XP; Tomcat 5.5
>            Reporter: Nianhua Li
>            Assignee: Daniel Kulp
>             Fix For: 2.0.4
>
>
> I am using the java-first approach with spring configuration on cxf 2.0.3 and tomcat 5.5. I specified namespace for all the input and output parameters via @WebParam and @WebResult annotation. But the namespace was somehow missing from the SOAP message.
> You can reproduce the problem by using the following test code (server side):
> =================web.xml========================================
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <!DOCTYPE web-app
>     PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
>     "http://java.sun.com/dtd/web-app_2_3.dtd">
> <web-app>
> 	<context-param>
> 		<param-name>contextConfigLocation</param-name>
> 		<param-value>WEB-INF/beans.xml</param-value>
> 	</context-param>
> 	<listener>
> 		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
> 	</listener>
> 	<servlet>
> 		<servlet-name>CXFServlet</servlet-name>
> 		<display-name>CXF Servlet</display-name>
> 		<servlet-class>
> 			org.apache.cxf.transport.servlet.CXFServlet
> 		</servlet-class>
> 		<load-on-startup>1</load-on-startup>
> 	</servlet>
> 	<servlet-mapping>
> 		<servlet-name>CXFServlet</servlet-name>
> 		<url-pattern>/*</url-pattern>
> 	</servlet-mapping>
> </web-app>
> ---------------------------------------------------------------------------------------------------------------
> =================beans.xml=======================================
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 	xmlns:jaxws="http://cxf.apache.org/jaxws"
> 	xmlns:cxf="http://cxf.apache.org/core"
> 	xsi:schemaLocation="
> http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
> http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
> http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
> 	<import resource="classpath:META-INF/cxf/cxf.xml" />
> 	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
> 	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
>     <bean id="logInbound" class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
>     <bean id="logOutbound" class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
>     <cxf:bus>
>         <cxf:inInterceptors> <ref bean="logInbound"/>  </cxf:inInterceptors>
>         <cxf:outInterceptors> <ref bean="logOutbound"/> </cxf:outInterceptors>
>         <cxf:inFaultInterceptors>  <ref bean="logOutbound"/>  </cxf:inFaultInterceptors>
>     </cxf:bus> 
>     <jaxws:endpoint   id="helloWorld"  implementor="demo.spring.HelloWorldImpl" 	  address="/HelloWorld" />
> </beans>
> -----------------------------------------------------------------------------------------------------------------------
> =================HelloWorld.java=======================================
> package demo.spring;
> import javax.jws.WebService;
> import javax.jws.WebMethod;
> import javax.jws.WebParam;
> import javax.jws.WebResult;
> import javax.xml.ws.ResponseWrapper;
> import javax.xml.ws.RequestWrapper;
> import javax.jws.soap.SOAPBinding;
> @WebService(name="MyHelloWorldService", targetNamespace="http://nstest.helloworld")
> @SOAPBinding(	parameterStyle=SOAPBinding.ParameterStyle.WRAPPED,
> 				style=SOAPBinding.Style.DOCUMENT,
> 				use= SOAPBinding.Use.LITERAL	)
> public interface HelloWorld {
> 	@WebMethod
> 	@WebResult(name="MyResult", targetNamespace="http://nstest.helloworld")
>     String sayHi(@WebParam(name="MyInput", targetNamespace="http://nstest.helloworld") String text);
> }
> -----------------------------------------------------------------------------------------------------------------------
> =================HelloWorldImpl.java=======================================
> package demo.spring;
> import javax.jws.WebService;
> import javax.jws.soap.SOAPBinding;
> @WebService(endpointInterface = "demo.spring.HelloWorld")
> public class HelloWorldImpl implements HelloWorld {
>     public String sayHi(String text) {
>         return "Hello " + text;
>     }
> }
> -----------------------------------------------------------------------------------------------------------------------
> Create WAR from the above code, deploy to tomcat, here is the WSDL I got from http://localhost:8080/...::
> =======main WSDL: http://localhost:8080/spring_http/HelloWorld?wsdl=================
> <?xml version="1.0" encoding="utf-8" ?> 
> - <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://nstest.helloworld" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://spring.demo/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="HelloWorldImplService" targetNamespace="http://spring.demo/">
>   <wsdl:import location="http://localhost:8080/spring_http/HelloWorld?wsdl=MyHelloWorldService.wsdl" namespace="http://nstest.helloworld" /> 
> - <wsdl:binding name="HelloWorldImplServiceSoapBinding" type="ns1:MyHelloWorldService">
>   <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> 
> - <wsdl:operation name="sayHi">
>   <soap:operation soapAction="" style="document" /> 
> - <wsdl:input name="sayHi">
>   <soap:body use="literal" /> 
>   </wsdl:input>
> - <wsdl:output name="sayHiResponse">
>   <soap:body use="literal" /> 
>   </wsdl:output>
>   </wsdl:operation>
>   </wsdl:binding>
> - <wsdl:service name="HelloWorldImplService">
> - <wsdl:port binding="tns:HelloWorldImplServiceSoapBinding" name="HelloWorldImplPort">
>   <soap:address location="http://localhost:8080/spring_http/HelloWorld" /> 
>   </wsdl:port>
>   </wsdl:service>
>   </wsdl:definitions>
> -----------------------------------------------------------------------------------------------------------------------------------------------
> =====imported WSDL: http://localhost:8080/spring_http/HelloWorld?wsdl=MyHelloWorldService.wsdl====
> <?xml version="1.0" encoding="utf-8" ?> 
> - <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://nstest.helloworld" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="MyHelloWorldService" targetNamespace="http://nstest.helloworld">
> - <wsdl:types>
> - <xsd:schema xmlns="http://nstest.helloworld" xmlns:tns="http://spring.demo/" attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://nstest.helloworld" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>   <import xmlns="http://www.w3.org/2001/XMLSchema" namespace="http://spring.demo/" /> 
>   <xsd:element name="sayHi" type="sayHi" /> 
> - <xsd:complexType name="sayHi">
> - <xsd:sequence>
>   <xsd:element minOccurs="0" name="MyInput" type="xsd:string" /> 
>   </xsd:sequence>
>   </xsd:complexType>
>   <xsd:element name="sayHiResponse" type="sayHiResponse" /> 
> - <xsd:complexType name="sayHiResponse">
> - <xsd:sequence>
>   <xsd:element minOccurs="0" name="MyResult" type="xsd:string" /> 
>   </xsd:sequence>
>   </xsd:complexType>
>   </xsd:schema>
>   </wsdl:types>
> - <wsdl:message name="sayHi">
>   <wsdl:part element="ns1:sayHi" name="parameters" /> 
>   </wsdl:message>
> - <wsdl:message name="sayHiResponse">
>   <wsdl:part element="ns1:sayHiResponse" name="parameters" /> 
>   </wsdl:message>
> - <wsdl:portType name="MyHelloWorldService">
> - <wsdl:operation name="sayHi">
>   <wsdl:input message="ns1:sayHi" name="sayHi" /> 
>   <wsdl:output message="ns1:sayHiResponse" name="sayHiResponse" /> 
>   </wsdl:operation>
>   </wsdl:portType>
>   </wsdl:definitions>
> -------------------------------------------------------------------------------------------------------------------------------------------
> Create client from WSDL by using wsdl2java. The namespaces of input/output parameters have already been missing from the generated service interface:
> ================MyHelloWorldService.java (generated by wsdl2java)====================== 
> package helloworld.nstest;
> import javax.jws.WebParam.Mode;
> import javax.jws.WebParam;
> import javax.jws.WebService;
> import javax.jws.soap.SOAPBinding.Style;
> import javax.jws.soap.SOAPBinding;
> import javax.jws.WebMethod;
> import javax.jws.WebResult;
> import javax.xml.ws.RequestWrapper;
> import javax.xml.ws.ResponseWrapper;
> /**
>  * This class was generated by Apache CXF (incubator) 2.0.3-incubator
>  * Tue Nov 20 22:45:47 EST 2007
>  * Generated source version: 2.0.3-incubator
>  * 
>  */
> @WebService(targetNamespace = "http://nstest.helloworld", name = "MyHelloWorldService")
> public interface MyHelloWorldService {
>     @ResponseWrapper(targetNamespace = "http://nstest.helloworld", className = "helloworld.nstest.SayHiResponse", localName = "sayHiResponse")
>     @RequestWrapper(targetNamespace = "http://nstest.helloworld", className = "helloworld.nstest.SayHi", localName = "sayHi")
>     @WebResult(targetNamespace = "", name = "MyResult")
>     @WebMethod
>     public java.lang.String sayHi(
>         @WebParam(targetNamespace = "", name = "MyInput")
>         java.lang.String myInput
>     );
> }
> ===================================================================
> Modify the generated client:
> ========MyHelloWorldService_HelloWorldImplPort_Client.java (generated by wsdl2java)======
> package helloworld.nstest;
> import java.io.File;
> import java.net.MalformedURLException;
> import java.net.URL;
> import javax.xml.namespace.QName;
> import demo.spring.HelloWorldImplService;
> import javax.jws.WebMethod;
> import javax.jws.WebResult;
> import javax.xml.ws.RequestWrapper;
> import javax.xml.ws.ResponseWrapper;
> public final class MyHelloWorldService_HelloWorldImplPort_Client {
>     private static final QName SERVICE_NAME = new QName("http://spring.demo/", "HelloWorldImplService");
>     private MyHelloWorldService_HelloWorldImplPort_Client() {
>     }
>     public static void main(String args[]) throws Exception {
>       
>         HelloWorldImplService ss = new HelloWorldImplService();
>         MyHelloWorldService port = ss.getHelloWorldImplPort();     
>         {
>         System.out.println("Invoking sayHi...");
>         java.lang.String _sayHi_myInput = "ABC";
>         java.lang.String _sayHi__return = port.sayHi(_sayHi_myInput);
>         System.out.println("sayHi.result=" + _sayHi__return);
>         }
>         System.exit(0);
>     }
> }
> --------------------------------------------------------------------------------------------------------
> SOAP message captured on server-side:
> --------------------------------------
> Encoding: UTF-8
> Headers: {connection=[keep-alive], cache-control=[no-cache], host=[localhost:808
> 0], user-agent=[Java/1.5.0_12], transfer-encoding=[chunked], pragma=[no-cache],
> content-type=[text/xml; charset=UTF-8], accept=[*], soapaction=[""]}
> Message:
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body
> ><ns2:sayHi xmlns:ns2="http://nstest.helloworld"><MyInput>ABC</MyInput></ns2:say
> Hi></soap:Body></soap:Envelope>
> --------------------------------------
> Nov 20, 2007 10:51:13 PM org.apache.cxf.interceptor.LoggingOutInterceptor$Loggin
> gCallback onClose
> INFO: Outbound Message:
> --------------------------------------
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body
> ><ns1:sayHiResponse xmlns:ns1="http://nstest.helloworld"><MyResult>Hello ABC</My
> Result></ns1:sayHiResponse></soap:Body></soap:Envelope>-------------------------
> -------------
> You can see that both "MyInput" and "MyResult" have no namespace.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (CXF-1226) Missing input/output param namespace in SOAP

Posted by "Benson Margulies (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-1226?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Benson Margulies resolved CXF-1226.
-----------------------------------

       Resolution: Invalid
    Fix Version/s: 2.0.3
         Assignee: Benson Margulies

Your implementation class does not include an endpointInterface annotation to point to your SEI, so none of your namespace annotations are being looked at.


> Missing input/output param namespace in SOAP
> --------------------------------------------
>
>                 Key: CXF-1226
>                 URL: https://issues.apache.org/jira/browse/CXF-1226
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.0.2, 2.0.3
>         Environment: Windows XP; Tomcat 5.5
>            Reporter: Nianhua Li
>            Assignee: Benson Margulies
>             Fix For: 2.0.3
>
>
> I am using the java-first approach with spring configuration on cxf 2.0.3 and tomcat 5.5. I specified namespace for all the input and output parameters via @WebParam and @WebResult annotation. But the namespace was somehow missing from the SOAP message.
> You can reproduce the problem by using the following test code (server side):
> =================web.xml========================================
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <!DOCTYPE web-app
>     PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
>     "http://java.sun.com/dtd/web-app_2_3.dtd">
> <web-app>
> 	<context-param>
> 		<param-name>contextConfigLocation</param-name>
> 		<param-value>WEB-INF/beans.xml</param-value>
> 	</context-param>
> 	<listener>
> 		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
> 	</listener>
> 	<servlet>
> 		<servlet-name>CXFServlet</servlet-name>
> 		<display-name>CXF Servlet</display-name>
> 		<servlet-class>
> 			org.apache.cxf.transport.servlet.CXFServlet
> 		</servlet-class>
> 		<load-on-startup>1</load-on-startup>
> 	</servlet>
> 	<servlet-mapping>
> 		<servlet-name>CXFServlet</servlet-name>
> 		<url-pattern>/*</url-pattern>
> 	</servlet-mapping>
> </web-app>
> ---------------------------------------------------------------------------------------------------------------
> =================beans.xml=======================================
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 	xmlns:jaxws="http://cxf.apache.org/jaxws"
> 	xmlns:cxf="http://cxf.apache.org/core"
> 	xsi:schemaLocation="
> http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
> http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
> http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
> 	<import resource="classpath:META-INF/cxf/cxf.xml" />
> 	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
> 	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
>     <bean id="logInbound" class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
>     <bean id="logOutbound" class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
>     <cxf:bus>
>         <cxf:inInterceptors> <ref bean="logInbound"/>  </cxf:inInterceptors>
>         <cxf:outInterceptors> <ref bean="logOutbound"/> </cxf:outInterceptors>
>         <cxf:inFaultInterceptors>  <ref bean="logOutbound"/>  </cxf:inFaultInterceptors>
>     </cxf:bus> 
>     <jaxws:endpoint   id="helloWorld"  implementor="demo.spring.HelloWorldImpl" 	  address="/HelloWorld" />
> </beans>
> -----------------------------------------------------------------------------------------------------------------------
> =================HelloWorld.java=======================================
> package demo.spring;
> import javax.jws.WebService;
> import javax.jws.WebMethod;
> import javax.jws.WebParam;
> import javax.jws.WebResult;
> import javax.xml.ws.ResponseWrapper;
> import javax.xml.ws.RequestWrapper;
> import javax.jws.soap.SOAPBinding;
> @WebService(name="MyHelloWorldService", targetNamespace="http://nstest.helloworld")
> @SOAPBinding(	parameterStyle=SOAPBinding.ParameterStyle.WRAPPED,
> 				style=SOAPBinding.Style.DOCUMENT,
> 				use= SOAPBinding.Use.LITERAL	)
> public interface HelloWorld {
> 	@WebMethod
> 	@WebResult(name="MyResult", targetNamespace="http://nstest.helloworld")
>     String sayHi(@WebParam(name="MyInput", targetNamespace="http://nstest.helloworld") String text);
> }
> -----------------------------------------------------------------------------------------------------------------------
> =================HelloWorldImpl.java=======================================
> package demo.spring;
> import javax.jws.WebService;
> import javax.jws.soap.SOAPBinding;
> @WebService(endpointInterface = "demo.spring.HelloWorld")
> public class HelloWorldImpl implements HelloWorld {
>     public String sayHi(String text) {
>         return "Hello " + text;
>     }
> }
> -----------------------------------------------------------------------------------------------------------------------
> Create WAR from the above code, deploy to tomcat, here is the WSDL I got from http://localhost:8080/...::
> =======main WSDL: http://localhost:8080/spring_http/HelloWorld?wsdl=================
> <?xml version="1.0" encoding="utf-8" ?> 
> - <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://nstest.helloworld" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://spring.demo/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="HelloWorldImplService" targetNamespace="http://spring.demo/">
>   <wsdl:import location="http://localhost:8080/spring_http/HelloWorld?wsdl=MyHelloWorldService.wsdl" namespace="http://nstest.helloworld" /> 
> - <wsdl:binding name="HelloWorldImplServiceSoapBinding" type="ns1:MyHelloWorldService">
>   <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> 
> - <wsdl:operation name="sayHi">
>   <soap:operation soapAction="" style="document" /> 
> - <wsdl:input name="sayHi">
>   <soap:body use="literal" /> 
>   </wsdl:input>
> - <wsdl:output name="sayHiResponse">
>   <soap:body use="literal" /> 
>   </wsdl:output>
>   </wsdl:operation>
>   </wsdl:binding>
> - <wsdl:service name="HelloWorldImplService">
> - <wsdl:port binding="tns:HelloWorldImplServiceSoapBinding" name="HelloWorldImplPort">
>   <soap:address location="http://localhost:8080/spring_http/HelloWorld" /> 
>   </wsdl:port>
>   </wsdl:service>
>   </wsdl:definitions>
> -----------------------------------------------------------------------------------------------------------------------------------------------
> =====imported WSDL: http://localhost:8080/spring_http/HelloWorld?wsdl=MyHelloWorldService.wsdl====
> <?xml version="1.0" encoding="utf-8" ?> 
> - <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://nstest.helloworld" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="MyHelloWorldService" targetNamespace="http://nstest.helloworld">
> - <wsdl:types>
> - <xsd:schema xmlns="http://nstest.helloworld" xmlns:tns="http://spring.demo/" attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://nstest.helloworld" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>   <import xmlns="http://www.w3.org/2001/XMLSchema" namespace="http://spring.demo/" /> 
>   <xsd:element name="sayHi" type="sayHi" /> 
> - <xsd:complexType name="sayHi">
> - <xsd:sequence>
>   <xsd:element minOccurs="0" name="MyInput" type="xsd:string" /> 
>   </xsd:sequence>
>   </xsd:complexType>
>   <xsd:element name="sayHiResponse" type="sayHiResponse" /> 
> - <xsd:complexType name="sayHiResponse">
> - <xsd:sequence>
>   <xsd:element minOccurs="0" name="MyResult" type="xsd:string" /> 
>   </xsd:sequence>
>   </xsd:complexType>
>   </xsd:schema>
>   </wsdl:types>
> - <wsdl:message name="sayHi">
>   <wsdl:part element="ns1:sayHi" name="parameters" /> 
>   </wsdl:message>
> - <wsdl:message name="sayHiResponse">
>   <wsdl:part element="ns1:sayHiResponse" name="parameters" /> 
>   </wsdl:message>
> - <wsdl:portType name="MyHelloWorldService">
> - <wsdl:operation name="sayHi">
>   <wsdl:input message="ns1:sayHi" name="sayHi" /> 
>   <wsdl:output message="ns1:sayHiResponse" name="sayHiResponse" /> 
>   </wsdl:operation>
>   </wsdl:portType>
>   </wsdl:definitions>
> -------------------------------------------------------------------------------------------------------------------------------------------
> Create client from WSDL by using wsdl2java. The namespaces of input/output parameters have already been missing from the generated service interface:
> ================MyHelloWorldService.java (generated by wsdl2java)====================== 
> package helloworld.nstest;
> import javax.jws.WebParam.Mode;
> import javax.jws.WebParam;
> import javax.jws.WebService;
> import javax.jws.soap.SOAPBinding.Style;
> import javax.jws.soap.SOAPBinding;
> import javax.jws.WebMethod;
> import javax.jws.WebResult;
> import javax.xml.ws.RequestWrapper;
> import javax.xml.ws.ResponseWrapper;
> /**
>  * This class was generated by Apache CXF (incubator) 2.0.3-incubator
>  * Tue Nov 20 22:45:47 EST 2007
>  * Generated source version: 2.0.3-incubator
>  * 
>  */
> @WebService(targetNamespace = "http://nstest.helloworld", name = "MyHelloWorldService")
> public interface MyHelloWorldService {
>     @ResponseWrapper(targetNamespace = "http://nstest.helloworld", className = "helloworld.nstest.SayHiResponse", localName = "sayHiResponse")
>     @RequestWrapper(targetNamespace = "http://nstest.helloworld", className = "helloworld.nstest.SayHi", localName = "sayHi")
>     @WebResult(targetNamespace = "", name = "MyResult")
>     @WebMethod
>     public java.lang.String sayHi(
>         @WebParam(targetNamespace = "", name = "MyInput")
>         java.lang.String myInput
>     );
> }
> ===================================================================
> Modify the generated client:
> ========MyHelloWorldService_HelloWorldImplPort_Client.java (generated by wsdl2java)======
> package helloworld.nstest;
> import java.io.File;
> import java.net.MalformedURLException;
> import java.net.URL;
> import javax.xml.namespace.QName;
> import demo.spring.HelloWorldImplService;
> import javax.jws.WebMethod;
> import javax.jws.WebResult;
> import javax.xml.ws.RequestWrapper;
> import javax.xml.ws.ResponseWrapper;
> public final class MyHelloWorldService_HelloWorldImplPort_Client {
>     private static final QName SERVICE_NAME = new QName("http://spring.demo/", "HelloWorldImplService");
>     private MyHelloWorldService_HelloWorldImplPort_Client() {
>     }
>     public static void main(String args[]) throws Exception {
>       
>         HelloWorldImplService ss = new HelloWorldImplService();
>         MyHelloWorldService port = ss.getHelloWorldImplPort();     
>         {
>         System.out.println("Invoking sayHi...");
>         java.lang.String _sayHi_myInput = "ABC";
>         java.lang.String _sayHi__return = port.sayHi(_sayHi_myInput);
>         System.out.println("sayHi.result=" + _sayHi__return);
>         }
>         System.exit(0);
>     }
> }
> --------------------------------------------------------------------------------------------------------
> SOAP message captured on server-side:
> --------------------------------------
> Encoding: UTF-8
> Headers: {connection=[keep-alive], cache-control=[no-cache], host=[localhost:808
> 0], user-agent=[Java/1.5.0_12], transfer-encoding=[chunked], pragma=[no-cache],
> content-type=[text/xml; charset=UTF-8], accept=[*], soapaction=[""]}
> Message:
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body
> ><ns2:sayHi xmlns:ns2="http://nstest.helloworld"><MyInput>ABC</MyInput></ns2:say
> Hi></soap:Body></soap:Envelope>
> --------------------------------------
> Nov 20, 2007 10:51:13 PM org.apache.cxf.interceptor.LoggingOutInterceptor$Loggin
> gCallback onClose
> INFO: Outbound Message:
> --------------------------------------
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body
> ><ns1:sayHiResponse xmlns:ns1="http://nstest.helloworld"><MyResult>Hello ABC</My
> Result></ns1:sayHiResponse></soap:Body></soap:Envelope>-------------------------
> -------------
> You can see that both "MyInput" and "MyResult" have no namespace.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-1226) Missing input/output param namespace in SOAP

Posted by "Nianhua Li (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-1226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12545471 ] 

Nianhua Li commented on CXF-1226:
---------------------------------

Thanks for the quick reply. 

About the WSDL: I didn't generate WSDL from java2wsdl. I deploy the
service WAR file (say spring_http.war, no WSDL included in it) to
tomcat, and then I see the WSDL from my web browser, e.g.
http://localhost:8080/spring_http/HelloWorld?wsdl. 

About the endpointInterface annotation: I am still confused. The
implementation class HelloWorldImpl in my issue report contains this
line:
 	@WebService(endpointInterface = "demo.spring.HelloWorld")
If this is not the correct annotation, could you please give out the
correct version? 

Thanks

nianhua



> Missing input/output param namespace in SOAP
> --------------------------------------------
>
>                 Key: CXF-1226
>                 URL: https://issues.apache.org/jira/browse/CXF-1226
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.0.2, 2.0.3
>         Environment: Windows XP; Tomcat 5.5
>            Reporter: Nianhua Li
>            Assignee: Benson Margulies
>             Fix For: 2.0.3
>
>
> I am using the java-first approach with spring configuration on cxf 2.0.3 and tomcat 5.5. I specified namespace for all the input and output parameters via @WebParam and @WebResult annotation. But the namespace was somehow missing from the SOAP message.
> You can reproduce the problem by using the following test code (server side):
> =================web.xml========================================
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <!DOCTYPE web-app
>     PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
>     "http://java.sun.com/dtd/web-app_2_3.dtd">
> <web-app>
> 	<context-param>
> 		<param-name>contextConfigLocation</param-name>
> 		<param-value>WEB-INF/beans.xml</param-value>
> 	</context-param>
> 	<listener>
> 		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
> 	</listener>
> 	<servlet>
> 		<servlet-name>CXFServlet</servlet-name>
> 		<display-name>CXF Servlet</display-name>
> 		<servlet-class>
> 			org.apache.cxf.transport.servlet.CXFServlet
> 		</servlet-class>
> 		<load-on-startup>1</load-on-startup>
> 	</servlet>
> 	<servlet-mapping>
> 		<servlet-name>CXFServlet</servlet-name>
> 		<url-pattern>/*</url-pattern>
> 	</servlet-mapping>
> </web-app>
> ---------------------------------------------------------------------------------------------------------------
> =================beans.xml=======================================
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 	xmlns:jaxws="http://cxf.apache.org/jaxws"
> 	xmlns:cxf="http://cxf.apache.org/core"
> 	xsi:schemaLocation="
> http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
> http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
> http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
> 	<import resource="classpath:META-INF/cxf/cxf.xml" />
> 	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
> 	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
>     <bean id="logInbound" class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
>     <bean id="logOutbound" class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
>     <cxf:bus>
>         <cxf:inInterceptors> <ref bean="logInbound"/>  </cxf:inInterceptors>
>         <cxf:outInterceptors> <ref bean="logOutbound"/> </cxf:outInterceptors>
>         <cxf:inFaultInterceptors>  <ref bean="logOutbound"/>  </cxf:inFaultInterceptors>
>     </cxf:bus> 
>     <jaxws:endpoint   id="helloWorld"  implementor="demo.spring.HelloWorldImpl" 	  address="/HelloWorld" />
> </beans>
> -----------------------------------------------------------------------------------------------------------------------
> =================HelloWorld.java=======================================
> package demo.spring;
> import javax.jws.WebService;
> import javax.jws.WebMethod;
> import javax.jws.WebParam;
> import javax.jws.WebResult;
> import javax.xml.ws.ResponseWrapper;
> import javax.xml.ws.RequestWrapper;
> import javax.jws.soap.SOAPBinding;
> @WebService(name="MyHelloWorldService", targetNamespace="http://nstest.helloworld")
> @SOAPBinding(	parameterStyle=SOAPBinding.ParameterStyle.WRAPPED,
> 				style=SOAPBinding.Style.DOCUMENT,
> 				use= SOAPBinding.Use.LITERAL	)
> public interface HelloWorld {
> 	@WebMethod
> 	@WebResult(name="MyResult", targetNamespace="http://nstest.helloworld")
>     String sayHi(@WebParam(name="MyInput", targetNamespace="http://nstest.helloworld") String text);
> }
> -----------------------------------------------------------------------------------------------------------------------
> =================HelloWorldImpl.java=======================================
> package demo.spring;
> import javax.jws.WebService;
> import javax.jws.soap.SOAPBinding;
> @WebService(endpointInterface = "demo.spring.HelloWorld")
> public class HelloWorldImpl implements HelloWorld {
>     public String sayHi(String text) {
>         return "Hello " + text;
>     }
> }
> -----------------------------------------------------------------------------------------------------------------------
> Create WAR from the above code, deploy to tomcat, here is the WSDL I got from http://localhost:8080/...::
> =======main WSDL: http://localhost:8080/spring_http/HelloWorld?wsdl=================
> <?xml version="1.0" encoding="utf-8" ?> 
> - <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://nstest.helloworld" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://spring.demo/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="HelloWorldImplService" targetNamespace="http://spring.demo/">
>   <wsdl:import location="http://localhost:8080/spring_http/HelloWorld?wsdl=MyHelloWorldService.wsdl" namespace="http://nstest.helloworld" /> 
> - <wsdl:binding name="HelloWorldImplServiceSoapBinding" type="ns1:MyHelloWorldService">
>   <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> 
> - <wsdl:operation name="sayHi">
>   <soap:operation soapAction="" style="document" /> 
> - <wsdl:input name="sayHi">
>   <soap:body use="literal" /> 
>   </wsdl:input>
> - <wsdl:output name="sayHiResponse">
>   <soap:body use="literal" /> 
>   </wsdl:output>
>   </wsdl:operation>
>   </wsdl:binding>
> - <wsdl:service name="HelloWorldImplService">
> - <wsdl:port binding="tns:HelloWorldImplServiceSoapBinding" name="HelloWorldImplPort">
>   <soap:address location="http://localhost:8080/spring_http/HelloWorld" /> 
>   </wsdl:port>
>   </wsdl:service>
>   </wsdl:definitions>
> -----------------------------------------------------------------------------------------------------------------------------------------------
> =====imported WSDL: http://localhost:8080/spring_http/HelloWorld?wsdl=MyHelloWorldService.wsdl====
> <?xml version="1.0" encoding="utf-8" ?> 
> - <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://nstest.helloworld" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="MyHelloWorldService" targetNamespace="http://nstest.helloworld">
> - <wsdl:types>
> - <xsd:schema xmlns="http://nstest.helloworld" xmlns:tns="http://spring.demo/" attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://nstest.helloworld" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>   <import xmlns="http://www.w3.org/2001/XMLSchema" namespace="http://spring.demo/" /> 
>   <xsd:element name="sayHi" type="sayHi" /> 
> - <xsd:complexType name="sayHi">
> - <xsd:sequence>
>   <xsd:element minOccurs="0" name="MyInput" type="xsd:string" /> 
>   </xsd:sequence>
>   </xsd:complexType>
>   <xsd:element name="sayHiResponse" type="sayHiResponse" /> 
> - <xsd:complexType name="sayHiResponse">
> - <xsd:sequence>
>   <xsd:element minOccurs="0" name="MyResult" type="xsd:string" /> 
>   </xsd:sequence>
>   </xsd:complexType>
>   </xsd:schema>
>   </wsdl:types>
> - <wsdl:message name="sayHi">
>   <wsdl:part element="ns1:sayHi" name="parameters" /> 
>   </wsdl:message>
> - <wsdl:message name="sayHiResponse">
>   <wsdl:part element="ns1:sayHiResponse" name="parameters" /> 
>   </wsdl:message>
> - <wsdl:portType name="MyHelloWorldService">
> - <wsdl:operation name="sayHi">
>   <wsdl:input message="ns1:sayHi" name="sayHi" /> 
>   <wsdl:output message="ns1:sayHiResponse" name="sayHiResponse" /> 
>   </wsdl:operation>
>   </wsdl:portType>
>   </wsdl:definitions>
> -------------------------------------------------------------------------------------------------------------------------------------------
> Create client from WSDL by using wsdl2java. The namespaces of input/output parameters have already been missing from the generated service interface:
> ================MyHelloWorldService.java (generated by wsdl2java)====================== 
> package helloworld.nstest;
> import javax.jws.WebParam.Mode;
> import javax.jws.WebParam;
> import javax.jws.WebService;
> import javax.jws.soap.SOAPBinding.Style;
> import javax.jws.soap.SOAPBinding;
> import javax.jws.WebMethod;
> import javax.jws.WebResult;
> import javax.xml.ws.RequestWrapper;
> import javax.xml.ws.ResponseWrapper;
> /**
>  * This class was generated by Apache CXF (incubator) 2.0.3-incubator
>  * Tue Nov 20 22:45:47 EST 2007
>  * Generated source version: 2.0.3-incubator
>  * 
>  */
> @WebService(targetNamespace = "http://nstest.helloworld", name = "MyHelloWorldService")
> public interface MyHelloWorldService {
>     @ResponseWrapper(targetNamespace = "http://nstest.helloworld", className = "helloworld.nstest.SayHiResponse", localName = "sayHiResponse")
>     @RequestWrapper(targetNamespace = "http://nstest.helloworld", className = "helloworld.nstest.SayHi", localName = "sayHi")
>     @WebResult(targetNamespace = "", name = "MyResult")
>     @WebMethod
>     public java.lang.String sayHi(
>         @WebParam(targetNamespace = "", name = "MyInput")
>         java.lang.String myInput
>     );
> }
> ===================================================================
> Modify the generated client:
> ========MyHelloWorldService_HelloWorldImplPort_Client.java (generated by wsdl2java)======
> package helloworld.nstest;
> import java.io.File;
> import java.net.MalformedURLException;
> import java.net.URL;
> import javax.xml.namespace.QName;
> import demo.spring.HelloWorldImplService;
> import javax.jws.WebMethod;
> import javax.jws.WebResult;
> import javax.xml.ws.RequestWrapper;
> import javax.xml.ws.ResponseWrapper;
> public final class MyHelloWorldService_HelloWorldImplPort_Client {
>     private static final QName SERVICE_NAME = new QName("http://spring.demo/", "HelloWorldImplService");
>     private MyHelloWorldService_HelloWorldImplPort_Client() {
>     }
>     public static void main(String args[]) throws Exception {
>       
>         HelloWorldImplService ss = new HelloWorldImplService();
>         MyHelloWorldService port = ss.getHelloWorldImplPort();     
>         {
>         System.out.println("Invoking sayHi...");
>         java.lang.String _sayHi_myInput = "ABC";
>         java.lang.String _sayHi__return = port.sayHi(_sayHi_myInput);
>         System.out.println("sayHi.result=" + _sayHi__return);
>         }
>         System.exit(0);
>     }
> }
> --------------------------------------------------------------------------------------------------------
> SOAP message captured on server-side:
> --------------------------------------
> Encoding: UTF-8
> Headers: {connection=[keep-alive], cache-control=[no-cache], host=[localhost:808
> 0], user-agent=[Java/1.5.0_12], transfer-encoding=[chunked], pragma=[no-cache],
> content-type=[text/xml; charset=UTF-8], accept=[*], soapaction=[""]}
> Message:
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body
> ><ns2:sayHi xmlns:ns2="http://nstest.helloworld"><MyInput>ABC</MyInput></ns2:say
> Hi></soap:Body></soap:Envelope>
> --------------------------------------
> Nov 20, 2007 10:51:13 PM org.apache.cxf.interceptor.LoggingOutInterceptor$Loggin
> gCallback onClose
> INFO: Outbound Message:
> --------------------------------------
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body
> ><ns1:sayHiResponse xmlns:ns1="http://nstest.helloworld"><MyResult>Hello ABC</My
> Result></ns1:sayHiResponse></soap:Body></soap:Envelope>-------------------------
> -------------
> You can see that both "MyInput" and "MyResult" have no namespace.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-1226) Missing input/output param namespace in SOAP

Posted by "Nianhua Li (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-1226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12545457 ] 

Nianhua Li commented on CXF-1226:
---------------------------------

Please excuse for my silly question here. Could you be more specific
about the problem? Are you saying that my implementation class (i.e.
demo.spring.HelloWorldImpl) doesn't include an endpointInterface
annotation to my SEI (i.e. demo.spring.HelloWorld)? In another word,
this line:
   @WebService(endpointInterface = "demo.spring.HelloWorld")
is incorrect. Could you please kindly give out the correct annotation?

Many thanks

nianhua



> Missing input/output param namespace in SOAP
> --------------------------------------------
>
>                 Key: CXF-1226
>                 URL: https://issues.apache.org/jira/browse/CXF-1226
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.0.2, 2.0.3
>         Environment: Windows XP; Tomcat 5.5
>            Reporter: Nianhua Li
>            Assignee: Benson Margulies
>             Fix For: 2.0.3
>
>
> I am using the java-first approach with spring configuration on cxf 2.0.3 and tomcat 5.5. I specified namespace for all the input and output parameters via @WebParam and @WebResult annotation. But the namespace was somehow missing from the SOAP message.
> You can reproduce the problem by using the following test code (server side):
> =================web.xml========================================
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <!DOCTYPE web-app
>     PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
>     "http://java.sun.com/dtd/web-app_2_3.dtd">
> <web-app>
> 	<context-param>
> 		<param-name>contextConfigLocation</param-name>
> 		<param-value>WEB-INF/beans.xml</param-value>
> 	</context-param>
> 	<listener>
> 		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
> 	</listener>
> 	<servlet>
> 		<servlet-name>CXFServlet</servlet-name>
> 		<display-name>CXF Servlet</display-name>
> 		<servlet-class>
> 			org.apache.cxf.transport.servlet.CXFServlet
> 		</servlet-class>
> 		<load-on-startup>1</load-on-startup>
> 	</servlet>
> 	<servlet-mapping>
> 		<servlet-name>CXFServlet</servlet-name>
> 		<url-pattern>/*</url-pattern>
> 	</servlet-mapping>
> </web-app>
> ---------------------------------------------------------------------------------------------------------------
> =================beans.xml=======================================
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 	xmlns:jaxws="http://cxf.apache.org/jaxws"
> 	xmlns:cxf="http://cxf.apache.org/core"
> 	xsi:schemaLocation="
> http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
> http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
> http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
> 	<import resource="classpath:META-INF/cxf/cxf.xml" />
> 	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
> 	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
>     <bean id="logInbound" class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
>     <bean id="logOutbound" class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
>     <cxf:bus>
>         <cxf:inInterceptors> <ref bean="logInbound"/>  </cxf:inInterceptors>
>         <cxf:outInterceptors> <ref bean="logOutbound"/> </cxf:outInterceptors>
>         <cxf:inFaultInterceptors>  <ref bean="logOutbound"/>  </cxf:inFaultInterceptors>
>     </cxf:bus> 
>     <jaxws:endpoint   id="helloWorld"  implementor="demo.spring.HelloWorldImpl" 	  address="/HelloWorld" />
> </beans>
> -----------------------------------------------------------------------------------------------------------------------
> =================HelloWorld.java=======================================
> package demo.spring;
> import javax.jws.WebService;
> import javax.jws.WebMethod;
> import javax.jws.WebParam;
> import javax.jws.WebResult;
> import javax.xml.ws.ResponseWrapper;
> import javax.xml.ws.RequestWrapper;
> import javax.jws.soap.SOAPBinding;
> @WebService(name="MyHelloWorldService", targetNamespace="http://nstest.helloworld")
> @SOAPBinding(	parameterStyle=SOAPBinding.ParameterStyle.WRAPPED,
> 				style=SOAPBinding.Style.DOCUMENT,
> 				use= SOAPBinding.Use.LITERAL	)
> public interface HelloWorld {
> 	@WebMethod
> 	@WebResult(name="MyResult", targetNamespace="http://nstest.helloworld")
>     String sayHi(@WebParam(name="MyInput", targetNamespace="http://nstest.helloworld") String text);
> }
> -----------------------------------------------------------------------------------------------------------------------
> =================HelloWorldImpl.java=======================================
> package demo.spring;
> import javax.jws.WebService;
> import javax.jws.soap.SOAPBinding;
> @WebService(endpointInterface = "demo.spring.HelloWorld")
> public class HelloWorldImpl implements HelloWorld {
>     public String sayHi(String text) {
>         return "Hello " + text;
>     }
> }
> -----------------------------------------------------------------------------------------------------------------------
> Create WAR from the above code, deploy to tomcat, here is the WSDL I got from http://localhost:8080/...::
> =======main WSDL: http://localhost:8080/spring_http/HelloWorld?wsdl=================
> <?xml version="1.0" encoding="utf-8" ?> 
> - <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://nstest.helloworld" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://spring.demo/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="HelloWorldImplService" targetNamespace="http://spring.demo/">
>   <wsdl:import location="http://localhost:8080/spring_http/HelloWorld?wsdl=MyHelloWorldService.wsdl" namespace="http://nstest.helloworld" /> 
> - <wsdl:binding name="HelloWorldImplServiceSoapBinding" type="ns1:MyHelloWorldService">
>   <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> 
> - <wsdl:operation name="sayHi">
>   <soap:operation soapAction="" style="document" /> 
> - <wsdl:input name="sayHi">
>   <soap:body use="literal" /> 
>   </wsdl:input>
> - <wsdl:output name="sayHiResponse">
>   <soap:body use="literal" /> 
>   </wsdl:output>
>   </wsdl:operation>
>   </wsdl:binding>
> - <wsdl:service name="HelloWorldImplService">
> - <wsdl:port binding="tns:HelloWorldImplServiceSoapBinding" name="HelloWorldImplPort">
>   <soap:address location="http://localhost:8080/spring_http/HelloWorld" /> 
>   </wsdl:port>
>   </wsdl:service>
>   </wsdl:definitions>
> -----------------------------------------------------------------------------------------------------------------------------------------------
> =====imported WSDL: http://localhost:8080/spring_http/HelloWorld?wsdl=MyHelloWorldService.wsdl====
> <?xml version="1.0" encoding="utf-8" ?> 
> - <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://nstest.helloworld" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="MyHelloWorldService" targetNamespace="http://nstest.helloworld">
> - <wsdl:types>
> - <xsd:schema xmlns="http://nstest.helloworld" xmlns:tns="http://spring.demo/" attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://nstest.helloworld" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>   <import xmlns="http://www.w3.org/2001/XMLSchema" namespace="http://spring.demo/" /> 
>   <xsd:element name="sayHi" type="sayHi" /> 
> - <xsd:complexType name="sayHi">
> - <xsd:sequence>
>   <xsd:element minOccurs="0" name="MyInput" type="xsd:string" /> 
>   </xsd:sequence>
>   </xsd:complexType>
>   <xsd:element name="sayHiResponse" type="sayHiResponse" /> 
> - <xsd:complexType name="sayHiResponse">
> - <xsd:sequence>
>   <xsd:element minOccurs="0" name="MyResult" type="xsd:string" /> 
>   </xsd:sequence>
>   </xsd:complexType>
>   </xsd:schema>
>   </wsdl:types>
> - <wsdl:message name="sayHi">
>   <wsdl:part element="ns1:sayHi" name="parameters" /> 
>   </wsdl:message>
> - <wsdl:message name="sayHiResponse">
>   <wsdl:part element="ns1:sayHiResponse" name="parameters" /> 
>   </wsdl:message>
> - <wsdl:portType name="MyHelloWorldService">
> - <wsdl:operation name="sayHi">
>   <wsdl:input message="ns1:sayHi" name="sayHi" /> 
>   <wsdl:output message="ns1:sayHiResponse" name="sayHiResponse" /> 
>   </wsdl:operation>
>   </wsdl:portType>
>   </wsdl:definitions>
> -------------------------------------------------------------------------------------------------------------------------------------------
> Create client from WSDL by using wsdl2java. The namespaces of input/output parameters have already been missing from the generated service interface:
> ================MyHelloWorldService.java (generated by wsdl2java)====================== 
> package helloworld.nstest;
> import javax.jws.WebParam.Mode;
> import javax.jws.WebParam;
> import javax.jws.WebService;
> import javax.jws.soap.SOAPBinding.Style;
> import javax.jws.soap.SOAPBinding;
> import javax.jws.WebMethod;
> import javax.jws.WebResult;
> import javax.xml.ws.RequestWrapper;
> import javax.xml.ws.ResponseWrapper;
> /**
>  * This class was generated by Apache CXF (incubator) 2.0.3-incubator
>  * Tue Nov 20 22:45:47 EST 2007
>  * Generated source version: 2.0.3-incubator
>  * 
>  */
> @WebService(targetNamespace = "http://nstest.helloworld", name = "MyHelloWorldService")
> public interface MyHelloWorldService {
>     @ResponseWrapper(targetNamespace = "http://nstest.helloworld", className = "helloworld.nstest.SayHiResponse", localName = "sayHiResponse")
>     @RequestWrapper(targetNamespace = "http://nstest.helloworld", className = "helloworld.nstest.SayHi", localName = "sayHi")
>     @WebResult(targetNamespace = "", name = "MyResult")
>     @WebMethod
>     public java.lang.String sayHi(
>         @WebParam(targetNamespace = "", name = "MyInput")
>         java.lang.String myInput
>     );
> }
> ===================================================================
> Modify the generated client:
> ========MyHelloWorldService_HelloWorldImplPort_Client.java (generated by wsdl2java)======
> package helloworld.nstest;
> import java.io.File;
> import java.net.MalformedURLException;
> import java.net.URL;
> import javax.xml.namespace.QName;
> import demo.spring.HelloWorldImplService;
> import javax.jws.WebMethod;
> import javax.jws.WebResult;
> import javax.xml.ws.RequestWrapper;
> import javax.xml.ws.ResponseWrapper;
> public final class MyHelloWorldService_HelloWorldImplPort_Client {
>     private static final QName SERVICE_NAME = new QName("http://spring.demo/", "HelloWorldImplService");
>     private MyHelloWorldService_HelloWorldImplPort_Client() {
>     }
>     public static void main(String args[]) throws Exception {
>       
>         HelloWorldImplService ss = new HelloWorldImplService();
>         MyHelloWorldService port = ss.getHelloWorldImplPort();     
>         {
>         System.out.println("Invoking sayHi...");
>         java.lang.String _sayHi_myInput = "ABC";
>         java.lang.String _sayHi__return = port.sayHi(_sayHi_myInput);
>         System.out.println("sayHi.result=" + _sayHi__return);
>         }
>         System.exit(0);
>     }
> }
> --------------------------------------------------------------------------------------------------------
> SOAP message captured on server-side:
> --------------------------------------
> Encoding: UTF-8
> Headers: {connection=[keep-alive], cache-control=[no-cache], host=[localhost:808
> 0], user-agent=[Java/1.5.0_12], transfer-encoding=[chunked], pragma=[no-cache],
> content-type=[text/xml; charset=UTF-8], accept=[*], soapaction=[""]}
> Message:
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body
> ><ns2:sayHi xmlns:ns2="http://nstest.helloworld"><MyInput>ABC</MyInput></ns2:say
> Hi></soap:Body></soap:Envelope>
> --------------------------------------
> Nov 20, 2007 10:51:13 PM org.apache.cxf.interceptor.LoggingOutInterceptor$Loggin
> gCallback onClose
> INFO: Outbound Message:
> --------------------------------------
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body
> ><ns1:sayHiResponse xmlns:ns1="http://nstest.helloworld"><MyResult>Hello ABC</My
> Result></ns1:sayHiResponse></soap:Body></soap:Envelope>-------------------------
> -------------
> You can see that both "MyInput" and "MyResult" have no namespace.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (CXF-1226) elementFormDefault from package-info.java ignored with JAXWS+JAXB when there are no beans

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-1226?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Kulp resolved CXF-1226.
------------------------------

    Resolution: Fixed

> elementFormDefault from package-info.java ignored with JAXWS+JAXB when there are no beans
> -----------------------------------------------------------------------------------------
>
>                 Key: CXF-1226
>                 URL: https://issues.apache.org/jira/browse/CXF-1226
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.0.2, 2.0.3
>         Environment: Windows XP; Tomcat 5.5
>            Reporter: Nianhua Li
>            Assignee: Daniel Kulp
>             Fix For: 2.0.4
>
>
> I am using the java-first approach with spring configuration on cxf 2.0.3 and tomcat 5.5. I specified namespace for all the input and output parameters via @WebParam and @WebResult annotation. But the namespace was somehow missing from the SOAP message.
> You can reproduce the problem by using the following test code (server side):
> =================web.xml========================================
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <!DOCTYPE web-app
>     PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
>     "http://java.sun.com/dtd/web-app_2_3.dtd">
> <web-app>
> 	<context-param>
> 		<param-name>contextConfigLocation</param-name>
> 		<param-value>WEB-INF/beans.xml</param-value>
> 	</context-param>
> 	<listener>
> 		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
> 	</listener>
> 	<servlet>
> 		<servlet-name>CXFServlet</servlet-name>
> 		<display-name>CXF Servlet</display-name>
> 		<servlet-class>
> 			org.apache.cxf.transport.servlet.CXFServlet
> 		</servlet-class>
> 		<load-on-startup>1</load-on-startup>
> 	</servlet>
> 	<servlet-mapping>
> 		<servlet-name>CXFServlet</servlet-name>
> 		<url-pattern>/*</url-pattern>
> 	</servlet-mapping>
> </web-app>
> ---------------------------------------------------------------------------------------------------------------
> =================beans.xml=======================================
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 	xmlns:jaxws="http://cxf.apache.org/jaxws"
> 	xmlns:cxf="http://cxf.apache.org/core"
> 	xsi:schemaLocation="
> http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
> http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
> http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
> 	<import resource="classpath:META-INF/cxf/cxf.xml" />
> 	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
> 	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
>     <bean id="logInbound" class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
>     <bean id="logOutbound" class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
>     <cxf:bus>
>         <cxf:inInterceptors> <ref bean="logInbound"/>  </cxf:inInterceptors>
>         <cxf:outInterceptors> <ref bean="logOutbound"/> </cxf:outInterceptors>
>         <cxf:inFaultInterceptors>  <ref bean="logOutbound"/>  </cxf:inFaultInterceptors>
>     </cxf:bus> 
>     <jaxws:endpoint   id="helloWorld"  implementor="demo.spring.HelloWorldImpl" 	  address="/HelloWorld" />
> </beans>
> -----------------------------------------------------------------------------------------------------------------------
> =================HelloWorld.java=======================================
> package demo.spring;
> import javax.jws.WebService;
> import javax.jws.WebMethod;
> import javax.jws.WebParam;
> import javax.jws.WebResult;
> import javax.xml.ws.ResponseWrapper;
> import javax.xml.ws.RequestWrapper;
> import javax.jws.soap.SOAPBinding;
> @WebService(name="MyHelloWorldService", targetNamespace="http://nstest.helloworld")
> @SOAPBinding(	parameterStyle=SOAPBinding.ParameterStyle.WRAPPED,
> 				style=SOAPBinding.Style.DOCUMENT,
> 				use= SOAPBinding.Use.LITERAL	)
> public interface HelloWorld {
> 	@WebMethod
> 	@WebResult(name="MyResult", targetNamespace="http://nstest.helloworld")
>     String sayHi(@WebParam(name="MyInput", targetNamespace="http://nstest.helloworld") String text);
> }
> -----------------------------------------------------------------------------------------------------------------------
> =================HelloWorldImpl.java=======================================
> package demo.spring;
> import javax.jws.WebService;
> import javax.jws.soap.SOAPBinding;
> @WebService(endpointInterface = "demo.spring.HelloWorld")
> public class HelloWorldImpl implements HelloWorld {
>     public String sayHi(String text) {
>         return "Hello " + text;
>     }
> }
> -----------------------------------------------------------------------------------------------------------------------
> Create WAR from the above code, deploy to tomcat, here is the WSDL I got from http://localhost:8080/...::
> =======main WSDL: http://localhost:8080/spring_http/HelloWorld?wsdl=================
> <?xml version="1.0" encoding="utf-8" ?> 
> - <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://nstest.helloworld" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://spring.demo/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="HelloWorldImplService" targetNamespace="http://spring.demo/">
>   <wsdl:import location="http://localhost:8080/spring_http/HelloWorld?wsdl=MyHelloWorldService.wsdl" namespace="http://nstest.helloworld" /> 
> - <wsdl:binding name="HelloWorldImplServiceSoapBinding" type="ns1:MyHelloWorldService">
>   <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> 
> - <wsdl:operation name="sayHi">
>   <soap:operation soapAction="" style="document" /> 
> - <wsdl:input name="sayHi">
>   <soap:body use="literal" /> 
>   </wsdl:input>
> - <wsdl:output name="sayHiResponse">
>   <soap:body use="literal" /> 
>   </wsdl:output>
>   </wsdl:operation>
>   </wsdl:binding>
> - <wsdl:service name="HelloWorldImplService">
> - <wsdl:port binding="tns:HelloWorldImplServiceSoapBinding" name="HelloWorldImplPort">
>   <soap:address location="http://localhost:8080/spring_http/HelloWorld" /> 
>   </wsdl:port>
>   </wsdl:service>
>   </wsdl:definitions>
> -----------------------------------------------------------------------------------------------------------------------------------------------
> =====imported WSDL: http://localhost:8080/spring_http/HelloWorld?wsdl=MyHelloWorldService.wsdl====
> <?xml version="1.0" encoding="utf-8" ?> 
> - <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://nstest.helloworld" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="MyHelloWorldService" targetNamespace="http://nstest.helloworld">
> - <wsdl:types>
> - <xsd:schema xmlns="http://nstest.helloworld" xmlns:tns="http://spring.demo/" attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://nstest.helloworld" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>   <import xmlns="http://www.w3.org/2001/XMLSchema" namespace="http://spring.demo/" /> 
>   <xsd:element name="sayHi" type="sayHi" /> 
> - <xsd:complexType name="sayHi">
> - <xsd:sequence>
>   <xsd:element minOccurs="0" name="MyInput" type="xsd:string" /> 
>   </xsd:sequence>
>   </xsd:complexType>
>   <xsd:element name="sayHiResponse" type="sayHiResponse" /> 
> - <xsd:complexType name="sayHiResponse">
> - <xsd:sequence>
>   <xsd:element minOccurs="0" name="MyResult" type="xsd:string" /> 
>   </xsd:sequence>
>   </xsd:complexType>
>   </xsd:schema>
>   </wsdl:types>
> - <wsdl:message name="sayHi">
>   <wsdl:part element="ns1:sayHi" name="parameters" /> 
>   </wsdl:message>
> - <wsdl:message name="sayHiResponse">
>   <wsdl:part element="ns1:sayHiResponse" name="parameters" /> 
>   </wsdl:message>
> - <wsdl:portType name="MyHelloWorldService">
> - <wsdl:operation name="sayHi">
>   <wsdl:input message="ns1:sayHi" name="sayHi" /> 
>   <wsdl:output message="ns1:sayHiResponse" name="sayHiResponse" /> 
>   </wsdl:operation>
>   </wsdl:portType>
>   </wsdl:definitions>
> -------------------------------------------------------------------------------------------------------------------------------------------
> Create client from WSDL by using wsdl2java. The namespaces of input/output parameters have already been missing from the generated service interface:
> ================MyHelloWorldService.java (generated by wsdl2java)====================== 
> package helloworld.nstest;
> import javax.jws.WebParam.Mode;
> import javax.jws.WebParam;
> import javax.jws.WebService;
> import javax.jws.soap.SOAPBinding.Style;
> import javax.jws.soap.SOAPBinding;
> import javax.jws.WebMethod;
> import javax.jws.WebResult;
> import javax.xml.ws.RequestWrapper;
> import javax.xml.ws.ResponseWrapper;
> /**
>  * This class was generated by Apache CXF (incubator) 2.0.3-incubator
>  * Tue Nov 20 22:45:47 EST 2007
>  * Generated source version: 2.0.3-incubator
>  * 
>  */
> @WebService(targetNamespace = "http://nstest.helloworld", name = "MyHelloWorldService")
> public interface MyHelloWorldService {
>     @ResponseWrapper(targetNamespace = "http://nstest.helloworld", className = "helloworld.nstest.SayHiResponse", localName = "sayHiResponse")
>     @RequestWrapper(targetNamespace = "http://nstest.helloworld", className = "helloworld.nstest.SayHi", localName = "sayHi")
>     @WebResult(targetNamespace = "", name = "MyResult")
>     @WebMethod
>     public java.lang.String sayHi(
>         @WebParam(targetNamespace = "", name = "MyInput")
>         java.lang.String myInput
>     );
> }
> ===================================================================
> Modify the generated client:
> ========MyHelloWorldService_HelloWorldImplPort_Client.java (generated by wsdl2java)======
> package helloworld.nstest;
> import java.io.File;
> import java.net.MalformedURLException;
> import java.net.URL;
> import javax.xml.namespace.QName;
> import demo.spring.HelloWorldImplService;
> import javax.jws.WebMethod;
> import javax.jws.WebResult;
> import javax.xml.ws.RequestWrapper;
> import javax.xml.ws.ResponseWrapper;
> public final class MyHelloWorldService_HelloWorldImplPort_Client {
>     private static final QName SERVICE_NAME = new QName("http://spring.demo/", "HelloWorldImplService");
>     private MyHelloWorldService_HelloWorldImplPort_Client() {
>     }
>     public static void main(String args[]) throws Exception {
>       
>         HelloWorldImplService ss = new HelloWorldImplService();
>         MyHelloWorldService port = ss.getHelloWorldImplPort();     
>         {
>         System.out.println("Invoking sayHi...");
>         java.lang.String _sayHi_myInput = "ABC";
>         java.lang.String _sayHi__return = port.sayHi(_sayHi_myInput);
>         System.out.println("sayHi.result=" + _sayHi__return);
>         }
>         System.exit(0);
>     }
> }
> --------------------------------------------------------------------------------------------------------
> SOAP message captured on server-side:
> --------------------------------------
> Encoding: UTF-8
> Headers: {connection=[keep-alive], cache-control=[no-cache], host=[localhost:808
> 0], user-agent=[Java/1.5.0_12], transfer-encoding=[chunked], pragma=[no-cache],
> content-type=[text/xml; charset=UTF-8], accept=[*], soapaction=[""]}
> Message:
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body
> ><ns2:sayHi xmlns:ns2="http://nstest.helloworld"><MyInput>ABC</MyInput></ns2:say
> Hi></soap:Body></soap:Envelope>
> --------------------------------------
> Nov 20, 2007 10:51:13 PM org.apache.cxf.interceptor.LoggingOutInterceptor$Loggin
> gCallback onClose
> INFO: Outbound Message:
> --------------------------------------
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body
> ><ns1:sayHiResponse xmlns:ns1="http://nstest.helloworld"><MyResult>Hello ABC</My
> Result></ns1:sayHiResponse></soap:Body></soap:Envelope>-------------------------
> -------------
> You can see that both "MyInput" and "MyResult" have no namespace.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-1226) Missing input/output param namespace in SOAP

Posted by "Benson Margulies (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-1226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12545502 ] 

Benson Margulies commented on CXF-1226:
---------------------------------------

The problem here is that elementFormDefault is generated by JAXB+JAXWS as unqualified.

Since you have no bean types, JAXB is not involved, and JAXWS doesn't seem to be respecting package-info.java annotations. That might be a bug. If you add a package-info.java like:

@javax.xml.bind.annotation.XmlSchema(namespace = "http://nstest.helloworld", 
                                     elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)


and you have any jaxb-processed types involved, things might get better.


> Missing input/output param namespace in SOAP
> --------------------------------------------
>
>                 Key: CXF-1226
>                 URL: https://issues.apache.org/jira/browse/CXF-1226
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.0.2, 2.0.3
>         Environment: Windows XP; Tomcat 5.5
>            Reporter: Nianhua Li
>            Assignee: Benson Margulies
>             Fix For: 2.0.3
>
>
> I am using the java-first approach with spring configuration on cxf 2.0.3 and tomcat 5.5. I specified namespace for all the input and output parameters via @WebParam and @WebResult annotation. But the namespace was somehow missing from the SOAP message.
> You can reproduce the problem by using the following test code (server side):
> =================web.xml========================================
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <!DOCTYPE web-app
>     PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
>     "http://java.sun.com/dtd/web-app_2_3.dtd">
> <web-app>
> 	<context-param>
> 		<param-name>contextConfigLocation</param-name>
> 		<param-value>WEB-INF/beans.xml</param-value>
> 	</context-param>
> 	<listener>
> 		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
> 	</listener>
> 	<servlet>
> 		<servlet-name>CXFServlet</servlet-name>
> 		<display-name>CXF Servlet</display-name>
> 		<servlet-class>
> 			org.apache.cxf.transport.servlet.CXFServlet
> 		</servlet-class>
> 		<load-on-startup>1</load-on-startup>
> 	</servlet>
> 	<servlet-mapping>
> 		<servlet-name>CXFServlet</servlet-name>
> 		<url-pattern>/*</url-pattern>
> 	</servlet-mapping>
> </web-app>
> ---------------------------------------------------------------------------------------------------------------
> =================beans.xml=======================================
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 	xmlns:jaxws="http://cxf.apache.org/jaxws"
> 	xmlns:cxf="http://cxf.apache.org/core"
> 	xsi:schemaLocation="
> http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
> http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
> http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
> 	<import resource="classpath:META-INF/cxf/cxf.xml" />
> 	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
> 	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
>     <bean id="logInbound" class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
>     <bean id="logOutbound" class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
>     <cxf:bus>
>         <cxf:inInterceptors> <ref bean="logInbound"/>  </cxf:inInterceptors>
>         <cxf:outInterceptors> <ref bean="logOutbound"/> </cxf:outInterceptors>
>         <cxf:inFaultInterceptors>  <ref bean="logOutbound"/>  </cxf:inFaultInterceptors>
>     </cxf:bus> 
>     <jaxws:endpoint   id="helloWorld"  implementor="demo.spring.HelloWorldImpl" 	  address="/HelloWorld" />
> </beans>
> -----------------------------------------------------------------------------------------------------------------------
> =================HelloWorld.java=======================================
> package demo.spring;
> import javax.jws.WebService;
> import javax.jws.WebMethod;
> import javax.jws.WebParam;
> import javax.jws.WebResult;
> import javax.xml.ws.ResponseWrapper;
> import javax.xml.ws.RequestWrapper;
> import javax.jws.soap.SOAPBinding;
> @WebService(name="MyHelloWorldService", targetNamespace="http://nstest.helloworld")
> @SOAPBinding(	parameterStyle=SOAPBinding.ParameterStyle.WRAPPED,
> 				style=SOAPBinding.Style.DOCUMENT,
> 				use= SOAPBinding.Use.LITERAL	)
> public interface HelloWorld {
> 	@WebMethod
> 	@WebResult(name="MyResult", targetNamespace="http://nstest.helloworld")
>     String sayHi(@WebParam(name="MyInput", targetNamespace="http://nstest.helloworld") String text);
> }
> -----------------------------------------------------------------------------------------------------------------------
> =================HelloWorldImpl.java=======================================
> package demo.spring;
> import javax.jws.WebService;
> import javax.jws.soap.SOAPBinding;
> @WebService(endpointInterface = "demo.spring.HelloWorld")
> public class HelloWorldImpl implements HelloWorld {
>     public String sayHi(String text) {
>         return "Hello " + text;
>     }
> }
> -----------------------------------------------------------------------------------------------------------------------
> Create WAR from the above code, deploy to tomcat, here is the WSDL I got from http://localhost:8080/...::
> =======main WSDL: http://localhost:8080/spring_http/HelloWorld?wsdl=================
> <?xml version="1.0" encoding="utf-8" ?> 
> - <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://nstest.helloworld" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://spring.demo/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="HelloWorldImplService" targetNamespace="http://spring.demo/">
>   <wsdl:import location="http://localhost:8080/spring_http/HelloWorld?wsdl=MyHelloWorldService.wsdl" namespace="http://nstest.helloworld" /> 
> - <wsdl:binding name="HelloWorldImplServiceSoapBinding" type="ns1:MyHelloWorldService">
>   <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> 
> - <wsdl:operation name="sayHi">
>   <soap:operation soapAction="" style="document" /> 
> - <wsdl:input name="sayHi">
>   <soap:body use="literal" /> 
>   </wsdl:input>
> - <wsdl:output name="sayHiResponse">
>   <soap:body use="literal" /> 
>   </wsdl:output>
>   </wsdl:operation>
>   </wsdl:binding>
> - <wsdl:service name="HelloWorldImplService">
> - <wsdl:port binding="tns:HelloWorldImplServiceSoapBinding" name="HelloWorldImplPort">
>   <soap:address location="http://localhost:8080/spring_http/HelloWorld" /> 
>   </wsdl:port>
>   </wsdl:service>
>   </wsdl:definitions>
> -----------------------------------------------------------------------------------------------------------------------------------------------
> =====imported WSDL: http://localhost:8080/spring_http/HelloWorld?wsdl=MyHelloWorldService.wsdl====
> <?xml version="1.0" encoding="utf-8" ?> 
> - <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://nstest.helloworld" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="MyHelloWorldService" targetNamespace="http://nstest.helloworld">
> - <wsdl:types>
> - <xsd:schema xmlns="http://nstest.helloworld" xmlns:tns="http://spring.demo/" attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://nstest.helloworld" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>   <import xmlns="http://www.w3.org/2001/XMLSchema" namespace="http://spring.demo/" /> 
>   <xsd:element name="sayHi" type="sayHi" /> 
> - <xsd:complexType name="sayHi">
> - <xsd:sequence>
>   <xsd:element minOccurs="0" name="MyInput" type="xsd:string" /> 
>   </xsd:sequence>
>   </xsd:complexType>
>   <xsd:element name="sayHiResponse" type="sayHiResponse" /> 
> - <xsd:complexType name="sayHiResponse">
> - <xsd:sequence>
>   <xsd:element minOccurs="0" name="MyResult" type="xsd:string" /> 
>   </xsd:sequence>
>   </xsd:complexType>
>   </xsd:schema>
>   </wsdl:types>
> - <wsdl:message name="sayHi">
>   <wsdl:part element="ns1:sayHi" name="parameters" /> 
>   </wsdl:message>
> - <wsdl:message name="sayHiResponse">
>   <wsdl:part element="ns1:sayHiResponse" name="parameters" /> 
>   </wsdl:message>
> - <wsdl:portType name="MyHelloWorldService">
> - <wsdl:operation name="sayHi">
>   <wsdl:input message="ns1:sayHi" name="sayHi" /> 
>   <wsdl:output message="ns1:sayHiResponse" name="sayHiResponse" /> 
>   </wsdl:operation>
>   </wsdl:portType>
>   </wsdl:definitions>
> -------------------------------------------------------------------------------------------------------------------------------------------
> Create client from WSDL by using wsdl2java. The namespaces of input/output parameters have already been missing from the generated service interface:
> ================MyHelloWorldService.java (generated by wsdl2java)====================== 
> package helloworld.nstest;
> import javax.jws.WebParam.Mode;
> import javax.jws.WebParam;
> import javax.jws.WebService;
> import javax.jws.soap.SOAPBinding.Style;
> import javax.jws.soap.SOAPBinding;
> import javax.jws.WebMethod;
> import javax.jws.WebResult;
> import javax.xml.ws.RequestWrapper;
> import javax.xml.ws.ResponseWrapper;
> /**
>  * This class was generated by Apache CXF (incubator) 2.0.3-incubator
>  * Tue Nov 20 22:45:47 EST 2007
>  * Generated source version: 2.0.3-incubator
>  * 
>  */
> @WebService(targetNamespace = "http://nstest.helloworld", name = "MyHelloWorldService")
> public interface MyHelloWorldService {
>     @ResponseWrapper(targetNamespace = "http://nstest.helloworld", className = "helloworld.nstest.SayHiResponse", localName = "sayHiResponse")
>     @RequestWrapper(targetNamespace = "http://nstest.helloworld", className = "helloworld.nstest.SayHi", localName = "sayHi")
>     @WebResult(targetNamespace = "", name = "MyResult")
>     @WebMethod
>     public java.lang.String sayHi(
>         @WebParam(targetNamespace = "", name = "MyInput")
>         java.lang.String myInput
>     );
> }
> ===================================================================
> Modify the generated client:
> ========MyHelloWorldService_HelloWorldImplPort_Client.java (generated by wsdl2java)======
> package helloworld.nstest;
> import java.io.File;
> import java.net.MalformedURLException;
> import java.net.URL;
> import javax.xml.namespace.QName;
> import demo.spring.HelloWorldImplService;
> import javax.jws.WebMethod;
> import javax.jws.WebResult;
> import javax.xml.ws.RequestWrapper;
> import javax.xml.ws.ResponseWrapper;
> public final class MyHelloWorldService_HelloWorldImplPort_Client {
>     private static final QName SERVICE_NAME = new QName("http://spring.demo/", "HelloWorldImplService");
>     private MyHelloWorldService_HelloWorldImplPort_Client() {
>     }
>     public static void main(String args[]) throws Exception {
>       
>         HelloWorldImplService ss = new HelloWorldImplService();
>         MyHelloWorldService port = ss.getHelloWorldImplPort();     
>         {
>         System.out.println("Invoking sayHi...");
>         java.lang.String _sayHi_myInput = "ABC";
>         java.lang.String _sayHi__return = port.sayHi(_sayHi_myInput);
>         System.out.println("sayHi.result=" + _sayHi__return);
>         }
>         System.exit(0);
>     }
> }
> --------------------------------------------------------------------------------------------------------
> SOAP message captured on server-side:
> --------------------------------------
> Encoding: UTF-8
> Headers: {connection=[keep-alive], cache-control=[no-cache], host=[localhost:808
> 0], user-agent=[Java/1.5.0_12], transfer-encoding=[chunked], pragma=[no-cache],
> content-type=[text/xml; charset=UTF-8], accept=[*], soapaction=[""]}
> Message:
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body
> ><ns2:sayHi xmlns:ns2="http://nstest.helloworld"><MyInput>ABC</MyInput></ns2:say
> Hi></soap:Body></soap:Envelope>
> --------------------------------------
> Nov 20, 2007 10:51:13 PM org.apache.cxf.interceptor.LoggingOutInterceptor$Loggin
> gCallback onClose
> INFO: Outbound Message:
> --------------------------------------
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body
> ><ns1:sayHiResponse xmlns:ns1="http://nstest.helloworld"><MyResult>Hello ABC</My
> Result></ns1:sayHiResponse></soap:Body></soap:Envelope>-------------------------
> -------------
> You can see that both "MyInput" and "MyResult" have no namespace.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-1226) Missing input/output param namespace in SOAP

Posted by "Nianhua Li (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-1226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12545463 ] 

Nianhua Li commented on CXF-1226:
---------------------------------

Actually I do believe that my namespace annotations in my SEI have been
looked at. I have only specified namespace "http://nstest.helloworld" in
my SEI, not anywhere else. The namespace has been included in the WSDL.
Therefore, either CXF's java-wsdl mapping or CXF's java-soap mapping is
wrong.

The other problem in this issue is on the client side. Forget about the
server side; assume we start from the WSDL. The input/output parameters
have namespace specified in WSDL. The client created from wsdl2java
should be consistent with the WSDL. Why the namespace get lost from the
SOAP message?

So, this issue indicates problems on both server and client side. I
believe both problems are valid. I don't understand why you close the
issue.


> Missing input/output param namespace in SOAP
> --------------------------------------------
>
>                 Key: CXF-1226
>                 URL: https://issues.apache.org/jira/browse/CXF-1226
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.0.2, 2.0.3
>         Environment: Windows XP; Tomcat 5.5
>            Reporter: Nianhua Li
>            Assignee: Benson Margulies
>             Fix For: 2.0.3
>
>
> I am using the java-first approach with spring configuration on cxf 2.0.3 and tomcat 5.5. I specified namespace for all the input and output parameters via @WebParam and @WebResult annotation. But the namespace was somehow missing from the SOAP message.
> You can reproduce the problem by using the following test code (server side):
> =================web.xml========================================
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <!DOCTYPE web-app
>     PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
>     "http://java.sun.com/dtd/web-app_2_3.dtd">
> <web-app>
> 	<context-param>
> 		<param-name>contextConfigLocation</param-name>
> 		<param-value>WEB-INF/beans.xml</param-value>
> 	</context-param>
> 	<listener>
> 		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
> 	</listener>
> 	<servlet>
> 		<servlet-name>CXFServlet</servlet-name>
> 		<display-name>CXF Servlet</display-name>
> 		<servlet-class>
> 			org.apache.cxf.transport.servlet.CXFServlet
> 		</servlet-class>
> 		<load-on-startup>1</load-on-startup>
> 	</servlet>
> 	<servlet-mapping>
> 		<servlet-name>CXFServlet</servlet-name>
> 		<url-pattern>/*</url-pattern>
> 	</servlet-mapping>
> </web-app>
> ---------------------------------------------------------------------------------------------------------------
> =================beans.xml=======================================
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 	xmlns:jaxws="http://cxf.apache.org/jaxws"
> 	xmlns:cxf="http://cxf.apache.org/core"
> 	xsi:schemaLocation="
> http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
> http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
> http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
> 	<import resource="classpath:META-INF/cxf/cxf.xml" />
> 	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
> 	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
>     <bean id="logInbound" class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
>     <bean id="logOutbound" class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
>     <cxf:bus>
>         <cxf:inInterceptors> <ref bean="logInbound"/>  </cxf:inInterceptors>
>         <cxf:outInterceptors> <ref bean="logOutbound"/> </cxf:outInterceptors>
>         <cxf:inFaultInterceptors>  <ref bean="logOutbound"/>  </cxf:inFaultInterceptors>
>     </cxf:bus> 
>     <jaxws:endpoint   id="helloWorld"  implementor="demo.spring.HelloWorldImpl" 	  address="/HelloWorld" />
> </beans>
> -----------------------------------------------------------------------------------------------------------------------
> =================HelloWorld.java=======================================
> package demo.spring;
> import javax.jws.WebService;
> import javax.jws.WebMethod;
> import javax.jws.WebParam;
> import javax.jws.WebResult;
> import javax.xml.ws.ResponseWrapper;
> import javax.xml.ws.RequestWrapper;
> import javax.jws.soap.SOAPBinding;
> @WebService(name="MyHelloWorldService", targetNamespace="http://nstest.helloworld")
> @SOAPBinding(	parameterStyle=SOAPBinding.ParameterStyle.WRAPPED,
> 				style=SOAPBinding.Style.DOCUMENT,
> 				use= SOAPBinding.Use.LITERAL	)
> public interface HelloWorld {
> 	@WebMethod
> 	@WebResult(name="MyResult", targetNamespace="http://nstest.helloworld")
>     String sayHi(@WebParam(name="MyInput", targetNamespace="http://nstest.helloworld") String text);
> }
> -----------------------------------------------------------------------------------------------------------------------
> =================HelloWorldImpl.java=======================================
> package demo.spring;
> import javax.jws.WebService;
> import javax.jws.soap.SOAPBinding;
> @WebService(endpointInterface = "demo.spring.HelloWorld")
> public class HelloWorldImpl implements HelloWorld {
>     public String sayHi(String text) {
>         return "Hello " + text;
>     }
> }
> -----------------------------------------------------------------------------------------------------------------------
> Create WAR from the above code, deploy to tomcat, here is the WSDL I got from http://localhost:8080/...::
> =======main WSDL: http://localhost:8080/spring_http/HelloWorld?wsdl=================
> <?xml version="1.0" encoding="utf-8" ?> 
> - <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://nstest.helloworld" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://spring.demo/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="HelloWorldImplService" targetNamespace="http://spring.demo/">
>   <wsdl:import location="http://localhost:8080/spring_http/HelloWorld?wsdl=MyHelloWorldService.wsdl" namespace="http://nstest.helloworld" /> 
> - <wsdl:binding name="HelloWorldImplServiceSoapBinding" type="ns1:MyHelloWorldService">
>   <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> 
> - <wsdl:operation name="sayHi">
>   <soap:operation soapAction="" style="document" /> 
> - <wsdl:input name="sayHi">
>   <soap:body use="literal" /> 
>   </wsdl:input>
> - <wsdl:output name="sayHiResponse">
>   <soap:body use="literal" /> 
>   </wsdl:output>
>   </wsdl:operation>
>   </wsdl:binding>
> - <wsdl:service name="HelloWorldImplService">
> - <wsdl:port binding="tns:HelloWorldImplServiceSoapBinding" name="HelloWorldImplPort">
>   <soap:address location="http://localhost:8080/spring_http/HelloWorld" /> 
>   </wsdl:port>
>   </wsdl:service>
>   </wsdl:definitions>
> -----------------------------------------------------------------------------------------------------------------------------------------------
> =====imported WSDL: http://localhost:8080/spring_http/HelloWorld?wsdl=MyHelloWorldService.wsdl====
> <?xml version="1.0" encoding="utf-8" ?> 
> - <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://nstest.helloworld" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="MyHelloWorldService" targetNamespace="http://nstest.helloworld">
> - <wsdl:types>
> - <xsd:schema xmlns="http://nstest.helloworld" xmlns:tns="http://spring.demo/" attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://nstest.helloworld" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>   <import xmlns="http://www.w3.org/2001/XMLSchema" namespace="http://spring.demo/" /> 
>   <xsd:element name="sayHi" type="sayHi" /> 
> - <xsd:complexType name="sayHi">
> - <xsd:sequence>
>   <xsd:element minOccurs="0" name="MyInput" type="xsd:string" /> 
>   </xsd:sequence>
>   </xsd:complexType>
>   <xsd:element name="sayHiResponse" type="sayHiResponse" /> 
> - <xsd:complexType name="sayHiResponse">
> - <xsd:sequence>
>   <xsd:element minOccurs="0" name="MyResult" type="xsd:string" /> 
>   </xsd:sequence>
>   </xsd:complexType>
>   </xsd:schema>
>   </wsdl:types>
> - <wsdl:message name="sayHi">
>   <wsdl:part element="ns1:sayHi" name="parameters" /> 
>   </wsdl:message>
> - <wsdl:message name="sayHiResponse">
>   <wsdl:part element="ns1:sayHiResponse" name="parameters" /> 
>   </wsdl:message>
> - <wsdl:portType name="MyHelloWorldService">
> - <wsdl:operation name="sayHi">
>   <wsdl:input message="ns1:sayHi" name="sayHi" /> 
>   <wsdl:output message="ns1:sayHiResponse" name="sayHiResponse" /> 
>   </wsdl:operation>
>   </wsdl:portType>
>   </wsdl:definitions>
> -------------------------------------------------------------------------------------------------------------------------------------------
> Create client from WSDL by using wsdl2java. The namespaces of input/output parameters have already been missing from the generated service interface:
> ================MyHelloWorldService.java (generated by wsdl2java)====================== 
> package helloworld.nstest;
> import javax.jws.WebParam.Mode;
> import javax.jws.WebParam;
> import javax.jws.WebService;
> import javax.jws.soap.SOAPBinding.Style;
> import javax.jws.soap.SOAPBinding;
> import javax.jws.WebMethod;
> import javax.jws.WebResult;
> import javax.xml.ws.RequestWrapper;
> import javax.xml.ws.ResponseWrapper;
> /**
>  * This class was generated by Apache CXF (incubator) 2.0.3-incubator
>  * Tue Nov 20 22:45:47 EST 2007
>  * Generated source version: 2.0.3-incubator
>  * 
>  */
> @WebService(targetNamespace = "http://nstest.helloworld", name = "MyHelloWorldService")
> public interface MyHelloWorldService {
>     @ResponseWrapper(targetNamespace = "http://nstest.helloworld", className = "helloworld.nstest.SayHiResponse", localName = "sayHiResponse")
>     @RequestWrapper(targetNamespace = "http://nstest.helloworld", className = "helloworld.nstest.SayHi", localName = "sayHi")
>     @WebResult(targetNamespace = "", name = "MyResult")
>     @WebMethod
>     public java.lang.String sayHi(
>         @WebParam(targetNamespace = "", name = "MyInput")
>         java.lang.String myInput
>     );
> }
> ===================================================================
> Modify the generated client:
> ========MyHelloWorldService_HelloWorldImplPort_Client.java (generated by wsdl2java)======
> package helloworld.nstest;
> import java.io.File;
> import java.net.MalformedURLException;
> import java.net.URL;
> import javax.xml.namespace.QName;
> import demo.spring.HelloWorldImplService;
> import javax.jws.WebMethod;
> import javax.jws.WebResult;
> import javax.xml.ws.RequestWrapper;
> import javax.xml.ws.ResponseWrapper;
> public final class MyHelloWorldService_HelloWorldImplPort_Client {
>     private static final QName SERVICE_NAME = new QName("http://spring.demo/", "HelloWorldImplService");
>     private MyHelloWorldService_HelloWorldImplPort_Client() {
>     }
>     public static void main(String args[]) throws Exception {
>       
>         HelloWorldImplService ss = new HelloWorldImplService();
>         MyHelloWorldService port = ss.getHelloWorldImplPort();     
>         {
>         System.out.println("Invoking sayHi...");
>         java.lang.String _sayHi_myInput = "ABC";
>         java.lang.String _sayHi__return = port.sayHi(_sayHi_myInput);
>         System.out.println("sayHi.result=" + _sayHi__return);
>         }
>         System.exit(0);
>     }
> }
> --------------------------------------------------------------------------------------------------------
> SOAP message captured on server-side:
> --------------------------------------
> Encoding: UTF-8
> Headers: {connection=[keep-alive], cache-control=[no-cache], host=[localhost:808
> 0], user-agent=[Java/1.5.0_12], transfer-encoding=[chunked], pragma=[no-cache],
> content-type=[text/xml; charset=UTF-8], accept=[*], soapaction=[""]}
> Message:
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body
> ><ns2:sayHi xmlns:ns2="http://nstest.helloworld"><MyInput>ABC</MyInput></ns2:say
> Hi></soap:Body></soap:Envelope>
> --------------------------------------
> Nov 20, 2007 10:51:13 PM org.apache.cxf.interceptor.LoggingOutInterceptor$Loggin
> gCallback onClose
> INFO: Outbound Message:
> --------------------------------------
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body
> ><ns1:sayHiResponse xmlns:ns1="http://nstest.helloworld"><MyResult>Hello ABC</My
> Result></ns1:sayHiResponse></soap:Body></soap:Envelope>-------------------------
> -------------
> You can see that both "MyInput" and "MyResult" have no namespace.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-1226) Missing input/output param namespace in SOAP

Posted by "Nianhua Li (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-1226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12545494 ] 

Nianhua Li commented on CXF-1226:
---------------------------------

Just FYI, I add targetNamespace= to my implementation class as you suggested, the WSDL looks prettier, but the problems remains.

=================Implementation Class====================
package demo.spring;

import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;

@WebService(name="MyHelloWorldService", targetNamespace="http://nstest.helloworld", 
			endpointInterface = "demo.spring.HelloWorld")

public class HelloWorldImpl implements HelloWorld {

    public String sayHi(String text) {
        return "Hello " + text;
    }
}
======================================================

============WSDL=====================================
<?xml version="1.0" encoding="utf-8" ?> 
- <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://nstest.helloworld" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="HelloWorldImplService" targetNamespace="http://nstest.helloworld">
- <wsdl:types>
- <xsd:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://nstest.helloworld" xmlns:tns="http://nstest.helloworld" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <xsd:element name="sayHi" type="tns:sayHi" /> 
- <xsd:complexType name="sayHi">
- <xsd:sequence>
  <xsd:element minOccurs="0" name="MyInput" type="xsd:string" /> 
  </xsd:sequence>
  </xsd:complexType>
  <xsd:element name="sayHiResponse" type="tns:sayHiResponse" /> 
- <xsd:complexType name="sayHiResponse">
- <xsd:sequence>
  <xsd:element minOccurs="0" name="MyResult" type="xsd:string" /> 
  </xsd:sequence>
  </xsd:complexType>
  </xsd:schema>
  </wsdl:types>
- <wsdl:message name="sayHi">
  <wsdl:part element="tns:sayHi" name="parameters" /> 
  </wsdl:message>
- <wsdl:message name="sayHiResponse">
  <wsdl:part element="tns:sayHiResponse" name="parameters" /> 
  </wsdl:message>
- <wsdl:portType name="MyHelloWorldService">
- <wsdl:operation name="sayHi">
  <wsdl:input message="tns:sayHi" name="sayHi" /> 
  <wsdl:output message="tns:sayHiResponse" name="sayHiResponse" /> 
  </wsdl:operation>
  </wsdl:portType>
- <wsdl:binding name="HelloWorldImplServiceSoapBinding" type="tns:MyHelloWorldService">
  <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> 
- <wsdl:operation name="sayHi">
  <soap:operation soapAction="" style="document" /> 
- <wsdl:input name="sayHi">
  <soap:body use="literal" /> 
  </wsdl:input>
- <wsdl:output name="sayHiResponse">
  <soap:body use="literal" /> 
  </wsdl:output>
  </wsdl:operation>
  </wsdl:binding>
- <wsdl:service name="HelloWorldImplService">
- <wsdl:port binding="tns:HelloWorldImplServiceSoapBinding" name="MyHelloWorldServicePort">
  <soap:address location="http://localhost:8080/spring_http/HelloWorld" /> 
  </wsdl:port>
  </wsdl:service>
  </wsdl:definitions>
===========================================================

> Missing input/output param namespace in SOAP
> --------------------------------------------
>
>                 Key: CXF-1226
>                 URL: https://issues.apache.org/jira/browse/CXF-1226
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.0.2, 2.0.3
>         Environment: Windows XP; Tomcat 5.5
>            Reporter: Nianhua Li
>            Assignee: Benson Margulies
>             Fix For: 2.0.3
>
>
> I am using the java-first approach with spring configuration on cxf 2.0.3 and tomcat 5.5. I specified namespace for all the input and output parameters via @WebParam and @WebResult annotation. But the namespace was somehow missing from the SOAP message.
> You can reproduce the problem by using the following test code (server side):
> =================web.xml========================================
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <!DOCTYPE web-app
>     PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
>     "http://java.sun.com/dtd/web-app_2_3.dtd">
> <web-app>
> 	<context-param>
> 		<param-name>contextConfigLocation</param-name>
> 		<param-value>WEB-INF/beans.xml</param-value>
> 	</context-param>
> 	<listener>
> 		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
> 	</listener>
> 	<servlet>
> 		<servlet-name>CXFServlet</servlet-name>
> 		<display-name>CXF Servlet</display-name>
> 		<servlet-class>
> 			org.apache.cxf.transport.servlet.CXFServlet
> 		</servlet-class>
> 		<load-on-startup>1</load-on-startup>
> 	</servlet>
> 	<servlet-mapping>
> 		<servlet-name>CXFServlet</servlet-name>
> 		<url-pattern>/*</url-pattern>
> 	</servlet-mapping>
> </web-app>
> ---------------------------------------------------------------------------------------------------------------
> =================beans.xml=======================================
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 	xmlns:jaxws="http://cxf.apache.org/jaxws"
> 	xmlns:cxf="http://cxf.apache.org/core"
> 	xsi:schemaLocation="
> http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
> http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
> http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
> 	<import resource="classpath:META-INF/cxf/cxf.xml" />
> 	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
> 	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
>     <bean id="logInbound" class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
>     <bean id="logOutbound" class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
>     <cxf:bus>
>         <cxf:inInterceptors> <ref bean="logInbound"/>  </cxf:inInterceptors>
>         <cxf:outInterceptors> <ref bean="logOutbound"/> </cxf:outInterceptors>
>         <cxf:inFaultInterceptors>  <ref bean="logOutbound"/>  </cxf:inFaultInterceptors>
>     </cxf:bus> 
>     <jaxws:endpoint   id="helloWorld"  implementor="demo.spring.HelloWorldImpl" 	  address="/HelloWorld" />
> </beans>
> -----------------------------------------------------------------------------------------------------------------------
> =================HelloWorld.java=======================================
> package demo.spring;
> import javax.jws.WebService;
> import javax.jws.WebMethod;
> import javax.jws.WebParam;
> import javax.jws.WebResult;
> import javax.xml.ws.ResponseWrapper;
> import javax.xml.ws.RequestWrapper;
> import javax.jws.soap.SOAPBinding;
> @WebService(name="MyHelloWorldService", targetNamespace="http://nstest.helloworld")
> @SOAPBinding(	parameterStyle=SOAPBinding.ParameterStyle.WRAPPED,
> 				style=SOAPBinding.Style.DOCUMENT,
> 				use= SOAPBinding.Use.LITERAL	)
> public interface HelloWorld {
> 	@WebMethod
> 	@WebResult(name="MyResult", targetNamespace="http://nstest.helloworld")
>     String sayHi(@WebParam(name="MyInput", targetNamespace="http://nstest.helloworld") String text);
> }
> -----------------------------------------------------------------------------------------------------------------------
> =================HelloWorldImpl.java=======================================
> package demo.spring;
> import javax.jws.WebService;
> import javax.jws.soap.SOAPBinding;
> @WebService(endpointInterface = "demo.spring.HelloWorld")
> public class HelloWorldImpl implements HelloWorld {
>     public String sayHi(String text) {
>         return "Hello " + text;
>     }
> }
> -----------------------------------------------------------------------------------------------------------------------
> Create WAR from the above code, deploy to tomcat, here is the WSDL I got from http://localhost:8080/...::
> =======main WSDL: http://localhost:8080/spring_http/HelloWorld?wsdl=================
> <?xml version="1.0" encoding="utf-8" ?> 
> - <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://nstest.helloworld" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://spring.demo/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="HelloWorldImplService" targetNamespace="http://spring.demo/">
>   <wsdl:import location="http://localhost:8080/spring_http/HelloWorld?wsdl=MyHelloWorldService.wsdl" namespace="http://nstest.helloworld" /> 
> - <wsdl:binding name="HelloWorldImplServiceSoapBinding" type="ns1:MyHelloWorldService">
>   <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> 
> - <wsdl:operation name="sayHi">
>   <soap:operation soapAction="" style="document" /> 
> - <wsdl:input name="sayHi">
>   <soap:body use="literal" /> 
>   </wsdl:input>
> - <wsdl:output name="sayHiResponse">
>   <soap:body use="literal" /> 
>   </wsdl:output>
>   </wsdl:operation>
>   </wsdl:binding>
> - <wsdl:service name="HelloWorldImplService">
> - <wsdl:port binding="tns:HelloWorldImplServiceSoapBinding" name="HelloWorldImplPort">
>   <soap:address location="http://localhost:8080/spring_http/HelloWorld" /> 
>   </wsdl:port>
>   </wsdl:service>
>   </wsdl:definitions>
> -----------------------------------------------------------------------------------------------------------------------------------------------
> =====imported WSDL: http://localhost:8080/spring_http/HelloWorld?wsdl=MyHelloWorldService.wsdl====
> <?xml version="1.0" encoding="utf-8" ?> 
> - <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://nstest.helloworld" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="MyHelloWorldService" targetNamespace="http://nstest.helloworld">
> - <wsdl:types>
> - <xsd:schema xmlns="http://nstest.helloworld" xmlns:tns="http://spring.demo/" attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://nstest.helloworld" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>   <import xmlns="http://www.w3.org/2001/XMLSchema" namespace="http://spring.demo/" /> 
>   <xsd:element name="sayHi" type="sayHi" /> 
> - <xsd:complexType name="sayHi">
> - <xsd:sequence>
>   <xsd:element minOccurs="0" name="MyInput" type="xsd:string" /> 
>   </xsd:sequence>
>   </xsd:complexType>
>   <xsd:element name="sayHiResponse" type="sayHiResponse" /> 
> - <xsd:complexType name="sayHiResponse">
> - <xsd:sequence>
>   <xsd:element minOccurs="0" name="MyResult" type="xsd:string" /> 
>   </xsd:sequence>
>   </xsd:complexType>
>   </xsd:schema>
>   </wsdl:types>
> - <wsdl:message name="sayHi">
>   <wsdl:part element="ns1:sayHi" name="parameters" /> 
>   </wsdl:message>
> - <wsdl:message name="sayHiResponse">
>   <wsdl:part element="ns1:sayHiResponse" name="parameters" /> 
>   </wsdl:message>
> - <wsdl:portType name="MyHelloWorldService">
> - <wsdl:operation name="sayHi">
>   <wsdl:input message="ns1:sayHi" name="sayHi" /> 
>   <wsdl:output message="ns1:sayHiResponse" name="sayHiResponse" /> 
>   </wsdl:operation>
>   </wsdl:portType>
>   </wsdl:definitions>
> -------------------------------------------------------------------------------------------------------------------------------------------
> Create client from WSDL by using wsdl2java. The namespaces of input/output parameters have already been missing from the generated service interface:
> ================MyHelloWorldService.java (generated by wsdl2java)====================== 
> package helloworld.nstest;
> import javax.jws.WebParam.Mode;
> import javax.jws.WebParam;
> import javax.jws.WebService;
> import javax.jws.soap.SOAPBinding.Style;
> import javax.jws.soap.SOAPBinding;
> import javax.jws.WebMethod;
> import javax.jws.WebResult;
> import javax.xml.ws.RequestWrapper;
> import javax.xml.ws.ResponseWrapper;
> /**
>  * This class was generated by Apache CXF (incubator) 2.0.3-incubator
>  * Tue Nov 20 22:45:47 EST 2007
>  * Generated source version: 2.0.3-incubator
>  * 
>  */
> @WebService(targetNamespace = "http://nstest.helloworld", name = "MyHelloWorldService")
> public interface MyHelloWorldService {
>     @ResponseWrapper(targetNamespace = "http://nstest.helloworld", className = "helloworld.nstest.SayHiResponse", localName = "sayHiResponse")
>     @RequestWrapper(targetNamespace = "http://nstest.helloworld", className = "helloworld.nstest.SayHi", localName = "sayHi")
>     @WebResult(targetNamespace = "", name = "MyResult")
>     @WebMethod
>     public java.lang.String sayHi(
>         @WebParam(targetNamespace = "", name = "MyInput")
>         java.lang.String myInput
>     );
> }
> ===================================================================
> Modify the generated client:
> ========MyHelloWorldService_HelloWorldImplPort_Client.java (generated by wsdl2java)======
> package helloworld.nstest;
> import java.io.File;
> import java.net.MalformedURLException;
> import java.net.URL;
> import javax.xml.namespace.QName;
> import demo.spring.HelloWorldImplService;
> import javax.jws.WebMethod;
> import javax.jws.WebResult;
> import javax.xml.ws.RequestWrapper;
> import javax.xml.ws.ResponseWrapper;
> public final class MyHelloWorldService_HelloWorldImplPort_Client {
>     private static final QName SERVICE_NAME = new QName("http://spring.demo/", "HelloWorldImplService");
>     private MyHelloWorldService_HelloWorldImplPort_Client() {
>     }
>     public static void main(String args[]) throws Exception {
>       
>         HelloWorldImplService ss = new HelloWorldImplService();
>         MyHelloWorldService port = ss.getHelloWorldImplPort();     
>         {
>         System.out.println("Invoking sayHi...");
>         java.lang.String _sayHi_myInput = "ABC";
>         java.lang.String _sayHi__return = port.sayHi(_sayHi_myInput);
>         System.out.println("sayHi.result=" + _sayHi__return);
>         }
>         System.exit(0);
>     }
> }
> --------------------------------------------------------------------------------------------------------
> SOAP message captured on server-side:
> --------------------------------------
> Encoding: UTF-8
> Headers: {connection=[keep-alive], cache-control=[no-cache], host=[localhost:808
> 0], user-agent=[Java/1.5.0_12], transfer-encoding=[chunked], pragma=[no-cache],
> content-type=[text/xml; charset=UTF-8], accept=[*], soapaction=[""]}
> Message:
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body
> ><ns2:sayHi xmlns:ns2="http://nstest.helloworld"><MyInput>ABC</MyInput></ns2:say
> Hi></soap:Body></soap:Envelope>
> --------------------------------------
> Nov 20, 2007 10:51:13 PM org.apache.cxf.interceptor.LoggingOutInterceptor$Loggin
> gCallback onClose
> INFO: Outbound Message:
> --------------------------------------
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body
> ><ns1:sayHiResponse xmlns:ns1="http://nstest.helloworld"><MyResult>Hello ABC</My
> Result></ns1:sayHiResponse></soap:Body></soap:Envelope>-------------------------
> -------------
> You can see that both "MyInput" and "MyResult" have no namespace.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Reopened: (CXF-1226) Missing input/output param namespace in SOAP

Posted by "Benson Margulies (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-1226?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Benson Margulies reopened CXF-1226:
-----------------------------------


I misread the original description.

> Missing input/output param namespace in SOAP
> --------------------------------------------
>
>                 Key: CXF-1226
>                 URL: https://issues.apache.org/jira/browse/CXF-1226
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.0.2, 2.0.3
>         Environment: Windows XP; Tomcat 5.5
>            Reporter: Nianhua Li
>            Assignee: Benson Margulies
>             Fix For: 2.0.3
>
>
> I am using the java-first approach with spring configuration on cxf 2.0.3 and tomcat 5.5. I specified namespace for all the input and output parameters via @WebParam and @WebResult annotation. But the namespace was somehow missing from the SOAP message.
> You can reproduce the problem by using the following test code (server side):
> =================web.xml========================================
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <!DOCTYPE web-app
>     PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
>     "http://java.sun.com/dtd/web-app_2_3.dtd">
> <web-app>
> 	<context-param>
> 		<param-name>contextConfigLocation</param-name>
> 		<param-value>WEB-INF/beans.xml</param-value>
> 	</context-param>
> 	<listener>
> 		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
> 	</listener>
> 	<servlet>
> 		<servlet-name>CXFServlet</servlet-name>
> 		<display-name>CXF Servlet</display-name>
> 		<servlet-class>
> 			org.apache.cxf.transport.servlet.CXFServlet
> 		</servlet-class>
> 		<load-on-startup>1</load-on-startup>
> 	</servlet>
> 	<servlet-mapping>
> 		<servlet-name>CXFServlet</servlet-name>
> 		<url-pattern>/*</url-pattern>
> 	</servlet-mapping>
> </web-app>
> ---------------------------------------------------------------------------------------------------------------
> =================beans.xml=======================================
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 	xmlns:jaxws="http://cxf.apache.org/jaxws"
> 	xmlns:cxf="http://cxf.apache.org/core"
> 	xsi:schemaLocation="
> http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
> http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
> http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
> 	<import resource="classpath:META-INF/cxf/cxf.xml" />
> 	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
> 	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
>     <bean id="logInbound" class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
>     <bean id="logOutbound" class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
>     <cxf:bus>
>         <cxf:inInterceptors> <ref bean="logInbound"/>  </cxf:inInterceptors>
>         <cxf:outInterceptors> <ref bean="logOutbound"/> </cxf:outInterceptors>
>         <cxf:inFaultInterceptors>  <ref bean="logOutbound"/>  </cxf:inFaultInterceptors>
>     </cxf:bus> 
>     <jaxws:endpoint   id="helloWorld"  implementor="demo.spring.HelloWorldImpl" 	  address="/HelloWorld" />
> </beans>
> -----------------------------------------------------------------------------------------------------------------------
> =================HelloWorld.java=======================================
> package demo.spring;
> import javax.jws.WebService;
> import javax.jws.WebMethod;
> import javax.jws.WebParam;
> import javax.jws.WebResult;
> import javax.xml.ws.ResponseWrapper;
> import javax.xml.ws.RequestWrapper;
> import javax.jws.soap.SOAPBinding;
> @WebService(name="MyHelloWorldService", targetNamespace="http://nstest.helloworld")
> @SOAPBinding(	parameterStyle=SOAPBinding.ParameterStyle.WRAPPED,
> 				style=SOAPBinding.Style.DOCUMENT,
> 				use= SOAPBinding.Use.LITERAL	)
> public interface HelloWorld {
> 	@WebMethod
> 	@WebResult(name="MyResult", targetNamespace="http://nstest.helloworld")
>     String sayHi(@WebParam(name="MyInput", targetNamespace="http://nstest.helloworld") String text);
> }
> -----------------------------------------------------------------------------------------------------------------------
> =================HelloWorldImpl.java=======================================
> package demo.spring;
> import javax.jws.WebService;
> import javax.jws.soap.SOAPBinding;
> @WebService(endpointInterface = "demo.spring.HelloWorld")
> public class HelloWorldImpl implements HelloWorld {
>     public String sayHi(String text) {
>         return "Hello " + text;
>     }
> }
> -----------------------------------------------------------------------------------------------------------------------
> Create WAR from the above code, deploy to tomcat, here is the WSDL I got from http://localhost:8080/...::
> =======main WSDL: http://localhost:8080/spring_http/HelloWorld?wsdl=================
> <?xml version="1.0" encoding="utf-8" ?> 
> - <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://nstest.helloworld" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://spring.demo/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="HelloWorldImplService" targetNamespace="http://spring.demo/">
>   <wsdl:import location="http://localhost:8080/spring_http/HelloWorld?wsdl=MyHelloWorldService.wsdl" namespace="http://nstest.helloworld" /> 
> - <wsdl:binding name="HelloWorldImplServiceSoapBinding" type="ns1:MyHelloWorldService">
>   <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> 
> - <wsdl:operation name="sayHi">
>   <soap:operation soapAction="" style="document" /> 
> - <wsdl:input name="sayHi">
>   <soap:body use="literal" /> 
>   </wsdl:input>
> - <wsdl:output name="sayHiResponse">
>   <soap:body use="literal" /> 
>   </wsdl:output>
>   </wsdl:operation>
>   </wsdl:binding>
> - <wsdl:service name="HelloWorldImplService">
> - <wsdl:port binding="tns:HelloWorldImplServiceSoapBinding" name="HelloWorldImplPort">
>   <soap:address location="http://localhost:8080/spring_http/HelloWorld" /> 
>   </wsdl:port>
>   </wsdl:service>
>   </wsdl:definitions>
> -----------------------------------------------------------------------------------------------------------------------------------------------
> =====imported WSDL: http://localhost:8080/spring_http/HelloWorld?wsdl=MyHelloWorldService.wsdl====
> <?xml version="1.0" encoding="utf-8" ?> 
> - <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://nstest.helloworld" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="MyHelloWorldService" targetNamespace="http://nstest.helloworld">
> - <wsdl:types>
> - <xsd:schema xmlns="http://nstest.helloworld" xmlns:tns="http://spring.demo/" attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://nstest.helloworld" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>   <import xmlns="http://www.w3.org/2001/XMLSchema" namespace="http://spring.demo/" /> 
>   <xsd:element name="sayHi" type="sayHi" /> 
> - <xsd:complexType name="sayHi">
> - <xsd:sequence>
>   <xsd:element minOccurs="0" name="MyInput" type="xsd:string" /> 
>   </xsd:sequence>
>   </xsd:complexType>
>   <xsd:element name="sayHiResponse" type="sayHiResponse" /> 
> - <xsd:complexType name="sayHiResponse">
> - <xsd:sequence>
>   <xsd:element minOccurs="0" name="MyResult" type="xsd:string" /> 
>   </xsd:sequence>
>   </xsd:complexType>
>   </xsd:schema>
>   </wsdl:types>
> - <wsdl:message name="sayHi">
>   <wsdl:part element="ns1:sayHi" name="parameters" /> 
>   </wsdl:message>
> - <wsdl:message name="sayHiResponse">
>   <wsdl:part element="ns1:sayHiResponse" name="parameters" /> 
>   </wsdl:message>
> - <wsdl:portType name="MyHelloWorldService">
> - <wsdl:operation name="sayHi">
>   <wsdl:input message="ns1:sayHi" name="sayHi" /> 
>   <wsdl:output message="ns1:sayHiResponse" name="sayHiResponse" /> 
>   </wsdl:operation>
>   </wsdl:portType>
>   </wsdl:definitions>
> -------------------------------------------------------------------------------------------------------------------------------------------
> Create client from WSDL by using wsdl2java. The namespaces of input/output parameters have already been missing from the generated service interface:
> ================MyHelloWorldService.java (generated by wsdl2java)====================== 
> package helloworld.nstest;
> import javax.jws.WebParam.Mode;
> import javax.jws.WebParam;
> import javax.jws.WebService;
> import javax.jws.soap.SOAPBinding.Style;
> import javax.jws.soap.SOAPBinding;
> import javax.jws.WebMethod;
> import javax.jws.WebResult;
> import javax.xml.ws.RequestWrapper;
> import javax.xml.ws.ResponseWrapper;
> /**
>  * This class was generated by Apache CXF (incubator) 2.0.3-incubator
>  * Tue Nov 20 22:45:47 EST 2007
>  * Generated source version: 2.0.3-incubator
>  * 
>  */
> @WebService(targetNamespace = "http://nstest.helloworld", name = "MyHelloWorldService")
> public interface MyHelloWorldService {
>     @ResponseWrapper(targetNamespace = "http://nstest.helloworld", className = "helloworld.nstest.SayHiResponse", localName = "sayHiResponse")
>     @RequestWrapper(targetNamespace = "http://nstest.helloworld", className = "helloworld.nstest.SayHi", localName = "sayHi")
>     @WebResult(targetNamespace = "", name = "MyResult")
>     @WebMethod
>     public java.lang.String sayHi(
>         @WebParam(targetNamespace = "", name = "MyInput")
>         java.lang.String myInput
>     );
> }
> ===================================================================
> Modify the generated client:
> ========MyHelloWorldService_HelloWorldImplPort_Client.java (generated by wsdl2java)======
> package helloworld.nstest;
> import java.io.File;
> import java.net.MalformedURLException;
> import java.net.URL;
> import javax.xml.namespace.QName;
> import demo.spring.HelloWorldImplService;
> import javax.jws.WebMethod;
> import javax.jws.WebResult;
> import javax.xml.ws.RequestWrapper;
> import javax.xml.ws.ResponseWrapper;
> public final class MyHelloWorldService_HelloWorldImplPort_Client {
>     private static final QName SERVICE_NAME = new QName("http://spring.demo/", "HelloWorldImplService");
>     private MyHelloWorldService_HelloWorldImplPort_Client() {
>     }
>     public static void main(String args[]) throws Exception {
>       
>         HelloWorldImplService ss = new HelloWorldImplService();
>         MyHelloWorldService port = ss.getHelloWorldImplPort();     
>         {
>         System.out.println("Invoking sayHi...");
>         java.lang.String _sayHi_myInput = "ABC";
>         java.lang.String _sayHi__return = port.sayHi(_sayHi_myInput);
>         System.out.println("sayHi.result=" + _sayHi__return);
>         }
>         System.exit(0);
>     }
> }
> --------------------------------------------------------------------------------------------------------
> SOAP message captured on server-side:
> --------------------------------------
> Encoding: UTF-8
> Headers: {connection=[keep-alive], cache-control=[no-cache], host=[localhost:808
> 0], user-agent=[Java/1.5.0_12], transfer-encoding=[chunked], pragma=[no-cache],
> content-type=[text/xml; charset=UTF-8], accept=[*], soapaction=[""]}
> Message:
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body
> ><ns2:sayHi xmlns:ns2="http://nstest.helloworld"><MyInput>ABC</MyInput></ns2:say
> Hi></soap:Body></soap:Envelope>
> --------------------------------------
> Nov 20, 2007 10:51:13 PM org.apache.cxf.interceptor.LoggingOutInterceptor$Loggin
> gCallback onClose
> INFO: Outbound Message:
> --------------------------------------
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body
> ><ns1:sayHiResponse xmlns:ns1="http://nstest.helloworld"><MyResult>Hello ABC</My
> Result></ns1:sayHiResponse></soap:Body></soap:Envelope>-------------------------
> -------------
> You can see that both "MyInput" and "MyResult" have no namespace.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-1226) elementFormDefault from package-info.java ignored with JAXWS+JAXB when there are no beans

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-1226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12561117#action_12561117 ] 

Daniel Kulp commented on CXF-1226:
----------------------------------

Tested a fix to honor the jAXB annotations in the package-info.java with the TCK and everything passes ok.   Thus, I'll get the fix committed in fro 2.0.4.

Dan


> elementFormDefault from package-info.java ignored with JAXWS+JAXB when there are no beans
> -----------------------------------------------------------------------------------------
>
>                 Key: CXF-1226
>                 URL: https://issues.apache.org/jira/browse/CXF-1226
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.0.2, 2.0.3
>         Environment: Windows XP; Tomcat 5.5
>            Reporter: Nianhua Li
>            Assignee: Daniel Kulp
>             Fix For: 2.0.4
>
>
> I am using the java-first approach with spring configuration on cxf 2.0.3 and tomcat 5.5. I specified namespace for all the input and output parameters via @WebParam and @WebResult annotation. But the namespace was somehow missing from the SOAP message.
> You can reproduce the problem by using the following test code (server side):
> =================web.xml========================================
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <!DOCTYPE web-app
>     PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
>     "http://java.sun.com/dtd/web-app_2_3.dtd">
> <web-app>
> 	<context-param>
> 		<param-name>contextConfigLocation</param-name>
> 		<param-value>WEB-INF/beans.xml</param-value>
> 	</context-param>
> 	<listener>
> 		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
> 	</listener>
> 	<servlet>
> 		<servlet-name>CXFServlet</servlet-name>
> 		<display-name>CXF Servlet</display-name>
> 		<servlet-class>
> 			org.apache.cxf.transport.servlet.CXFServlet
> 		</servlet-class>
> 		<load-on-startup>1</load-on-startup>
> 	</servlet>
> 	<servlet-mapping>
> 		<servlet-name>CXFServlet</servlet-name>
> 		<url-pattern>/*</url-pattern>
> 	</servlet-mapping>
> </web-app>
> ---------------------------------------------------------------------------------------------------------------
> =================beans.xml=======================================
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 	xmlns:jaxws="http://cxf.apache.org/jaxws"
> 	xmlns:cxf="http://cxf.apache.org/core"
> 	xsi:schemaLocation="
> http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
> http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
> http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
> 	<import resource="classpath:META-INF/cxf/cxf.xml" />
> 	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
> 	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
>     <bean id="logInbound" class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
>     <bean id="logOutbound" class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
>     <cxf:bus>
>         <cxf:inInterceptors> <ref bean="logInbound"/>  </cxf:inInterceptors>
>         <cxf:outInterceptors> <ref bean="logOutbound"/> </cxf:outInterceptors>
>         <cxf:inFaultInterceptors>  <ref bean="logOutbound"/>  </cxf:inFaultInterceptors>
>     </cxf:bus> 
>     <jaxws:endpoint   id="helloWorld"  implementor="demo.spring.HelloWorldImpl" 	  address="/HelloWorld" />
> </beans>
> -----------------------------------------------------------------------------------------------------------------------
> =================HelloWorld.java=======================================
> package demo.spring;
> import javax.jws.WebService;
> import javax.jws.WebMethod;
> import javax.jws.WebParam;
> import javax.jws.WebResult;
> import javax.xml.ws.ResponseWrapper;
> import javax.xml.ws.RequestWrapper;
> import javax.jws.soap.SOAPBinding;
> @WebService(name="MyHelloWorldService", targetNamespace="http://nstest.helloworld")
> @SOAPBinding(	parameterStyle=SOAPBinding.ParameterStyle.WRAPPED,
> 				style=SOAPBinding.Style.DOCUMENT,
> 				use= SOAPBinding.Use.LITERAL	)
> public interface HelloWorld {
> 	@WebMethod
> 	@WebResult(name="MyResult", targetNamespace="http://nstest.helloworld")
>     String sayHi(@WebParam(name="MyInput", targetNamespace="http://nstest.helloworld") String text);
> }
> -----------------------------------------------------------------------------------------------------------------------
> =================HelloWorldImpl.java=======================================
> package demo.spring;
> import javax.jws.WebService;
> import javax.jws.soap.SOAPBinding;
> @WebService(endpointInterface = "demo.spring.HelloWorld")
> public class HelloWorldImpl implements HelloWorld {
>     public String sayHi(String text) {
>         return "Hello " + text;
>     }
> }
> -----------------------------------------------------------------------------------------------------------------------
> Create WAR from the above code, deploy to tomcat, here is the WSDL I got from http://localhost:8080/...::
> =======main WSDL: http://localhost:8080/spring_http/HelloWorld?wsdl=================
> <?xml version="1.0" encoding="utf-8" ?> 
> - <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://nstest.helloworld" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://spring.demo/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="HelloWorldImplService" targetNamespace="http://spring.demo/">
>   <wsdl:import location="http://localhost:8080/spring_http/HelloWorld?wsdl=MyHelloWorldService.wsdl" namespace="http://nstest.helloworld" /> 
> - <wsdl:binding name="HelloWorldImplServiceSoapBinding" type="ns1:MyHelloWorldService">
>   <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> 
> - <wsdl:operation name="sayHi">
>   <soap:operation soapAction="" style="document" /> 
> - <wsdl:input name="sayHi">
>   <soap:body use="literal" /> 
>   </wsdl:input>
> - <wsdl:output name="sayHiResponse">
>   <soap:body use="literal" /> 
>   </wsdl:output>
>   </wsdl:operation>
>   </wsdl:binding>
> - <wsdl:service name="HelloWorldImplService">
> - <wsdl:port binding="tns:HelloWorldImplServiceSoapBinding" name="HelloWorldImplPort">
>   <soap:address location="http://localhost:8080/spring_http/HelloWorld" /> 
>   </wsdl:port>
>   </wsdl:service>
>   </wsdl:definitions>
> -----------------------------------------------------------------------------------------------------------------------------------------------
> =====imported WSDL: http://localhost:8080/spring_http/HelloWorld?wsdl=MyHelloWorldService.wsdl====
> <?xml version="1.0" encoding="utf-8" ?> 
> - <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://nstest.helloworld" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="MyHelloWorldService" targetNamespace="http://nstest.helloworld">
> - <wsdl:types>
> - <xsd:schema xmlns="http://nstest.helloworld" xmlns:tns="http://spring.demo/" attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://nstest.helloworld" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>   <import xmlns="http://www.w3.org/2001/XMLSchema" namespace="http://spring.demo/" /> 
>   <xsd:element name="sayHi" type="sayHi" /> 
> - <xsd:complexType name="sayHi">
> - <xsd:sequence>
>   <xsd:element minOccurs="0" name="MyInput" type="xsd:string" /> 
>   </xsd:sequence>
>   </xsd:complexType>
>   <xsd:element name="sayHiResponse" type="sayHiResponse" /> 
> - <xsd:complexType name="sayHiResponse">
> - <xsd:sequence>
>   <xsd:element minOccurs="0" name="MyResult" type="xsd:string" /> 
>   </xsd:sequence>
>   </xsd:complexType>
>   </xsd:schema>
>   </wsdl:types>
> - <wsdl:message name="sayHi">
>   <wsdl:part element="ns1:sayHi" name="parameters" /> 
>   </wsdl:message>
> - <wsdl:message name="sayHiResponse">
>   <wsdl:part element="ns1:sayHiResponse" name="parameters" /> 
>   </wsdl:message>
> - <wsdl:portType name="MyHelloWorldService">
> - <wsdl:operation name="sayHi">
>   <wsdl:input message="ns1:sayHi" name="sayHi" /> 
>   <wsdl:output message="ns1:sayHiResponse" name="sayHiResponse" /> 
>   </wsdl:operation>
>   </wsdl:portType>
>   </wsdl:definitions>
> -------------------------------------------------------------------------------------------------------------------------------------------
> Create client from WSDL by using wsdl2java. The namespaces of input/output parameters have already been missing from the generated service interface:
> ================MyHelloWorldService.java (generated by wsdl2java)====================== 
> package helloworld.nstest;
> import javax.jws.WebParam.Mode;
> import javax.jws.WebParam;
> import javax.jws.WebService;
> import javax.jws.soap.SOAPBinding.Style;
> import javax.jws.soap.SOAPBinding;
> import javax.jws.WebMethod;
> import javax.jws.WebResult;
> import javax.xml.ws.RequestWrapper;
> import javax.xml.ws.ResponseWrapper;
> /**
>  * This class was generated by Apache CXF (incubator) 2.0.3-incubator
>  * Tue Nov 20 22:45:47 EST 2007
>  * Generated source version: 2.0.3-incubator
>  * 
>  */
> @WebService(targetNamespace = "http://nstest.helloworld", name = "MyHelloWorldService")
> public interface MyHelloWorldService {
>     @ResponseWrapper(targetNamespace = "http://nstest.helloworld", className = "helloworld.nstest.SayHiResponse", localName = "sayHiResponse")
>     @RequestWrapper(targetNamespace = "http://nstest.helloworld", className = "helloworld.nstest.SayHi", localName = "sayHi")
>     @WebResult(targetNamespace = "", name = "MyResult")
>     @WebMethod
>     public java.lang.String sayHi(
>         @WebParam(targetNamespace = "", name = "MyInput")
>         java.lang.String myInput
>     );
> }
> ===================================================================
> Modify the generated client:
> ========MyHelloWorldService_HelloWorldImplPort_Client.java (generated by wsdl2java)======
> package helloworld.nstest;
> import java.io.File;
> import java.net.MalformedURLException;
> import java.net.URL;
> import javax.xml.namespace.QName;
> import demo.spring.HelloWorldImplService;
> import javax.jws.WebMethod;
> import javax.jws.WebResult;
> import javax.xml.ws.RequestWrapper;
> import javax.xml.ws.ResponseWrapper;
> public final class MyHelloWorldService_HelloWorldImplPort_Client {
>     private static final QName SERVICE_NAME = new QName("http://spring.demo/", "HelloWorldImplService");
>     private MyHelloWorldService_HelloWorldImplPort_Client() {
>     }
>     public static void main(String args[]) throws Exception {
>       
>         HelloWorldImplService ss = new HelloWorldImplService();
>         MyHelloWorldService port = ss.getHelloWorldImplPort();     
>         {
>         System.out.println("Invoking sayHi...");
>         java.lang.String _sayHi_myInput = "ABC";
>         java.lang.String _sayHi__return = port.sayHi(_sayHi_myInput);
>         System.out.println("sayHi.result=" + _sayHi__return);
>         }
>         System.exit(0);
>     }
> }
> --------------------------------------------------------------------------------------------------------
> SOAP message captured on server-side:
> --------------------------------------
> Encoding: UTF-8
> Headers: {connection=[keep-alive], cache-control=[no-cache], host=[localhost:808
> 0], user-agent=[Java/1.5.0_12], transfer-encoding=[chunked], pragma=[no-cache],
> content-type=[text/xml; charset=UTF-8], accept=[*], soapaction=[""]}
> Message:
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body
> ><ns2:sayHi xmlns:ns2="http://nstest.helloworld"><MyInput>ABC</MyInput></ns2:say
> Hi></soap:Body></soap:Envelope>
> --------------------------------------
> Nov 20, 2007 10:51:13 PM org.apache.cxf.interceptor.LoggingOutInterceptor$Loggin
> gCallback onClose
> INFO: Outbound Message:
> --------------------------------------
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body
> ><ns1:sayHiResponse xmlns:ns1="http://nstest.helloworld"><MyResult>Hello ABC</My
> Result></ns1:sayHiResponse></soap:Body></soap:Envelope>-------------------------
> -------------
> You can see that both "MyInput" and "MyResult" have no namespace.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-1226) Missing input/output param namespace in SOAP

Posted by "Benson Margulies (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-1226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12545464 ] 

Benson Margulies commented on CXF-1226:
---------------------------------------

elementFormDefault is unqualified. Should that not suppress the namespace prefixes? Have you tried generating the WSDL just from the SEI, not from the service class? Would you please try adding the endpointInterface annotation?

> Missing input/output param namespace in SOAP
> --------------------------------------------
>
>                 Key: CXF-1226
>                 URL: https://issues.apache.org/jira/browse/CXF-1226
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.0.2, 2.0.3
>         Environment: Windows XP; Tomcat 5.5
>            Reporter: Nianhua Li
>            Assignee: Benson Margulies
>             Fix For: 2.0.3
>
>
> I am using the java-first approach with spring configuration on cxf 2.0.3 and tomcat 5.5. I specified namespace for all the input and output parameters via @WebParam and @WebResult annotation. But the namespace was somehow missing from the SOAP message.
> You can reproduce the problem by using the following test code (server side):
> =================web.xml========================================
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <!DOCTYPE web-app
>     PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
>     "http://java.sun.com/dtd/web-app_2_3.dtd">
> <web-app>
> 	<context-param>
> 		<param-name>contextConfigLocation</param-name>
> 		<param-value>WEB-INF/beans.xml</param-value>
> 	</context-param>
> 	<listener>
> 		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
> 	</listener>
> 	<servlet>
> 		<servlet-name>CXFServlet</servlet-name>
> 		<display-name>CXF Servlet</display-name>
> 		<servlet-class>
> 			org.apache.cxf.transport.servlet.CXFServlet
> 		</servlet-class>
> 		<load-on-startup>1</load-on-startup>
> 	</servlet>
> 	<servlet-mapping>
> 		<servlet-name>CXFServlet</servlet-name>
> 		<url-pattern>/*</url-pattern>
> 	</servlet-mapping>
> </web-app>
> ---------------------------------------------------------------------------------------------------------------
> =================beans.xml=======================================
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 	xmlns:jaxws="http://cxf.apache.org/jaxws"
> 	xmlns:cxf="http://cxf.apache.org/core"
> 	xsi:schemaLocation="
> http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
> http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
> http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
> 	<import resource="classpath:META-INF/cxf/cxf.xml" />
> 	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
> 	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
>     <bean id="logInbound" class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
>     <bean id="logOutbound" class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
>     <cxf:bus>
>         <cxf:inInterceptors> <ref bean="logInbound"/>  </cxf:inInterceptors>
>         <cxf:outInterceptors> <ref bean="logOutbound"/> </cxf:outInterceptors>
>         <cxf:inFaultInterceptors>  <ref bean="logOutbound"/>  </cxf:inFaultInterceptors>
>     </cxf:bus> 
>     <jaxws:endpoint   id="helloWorld"  implementor="demo.spring.HelloWorldImpl" 	  address="/HelloWorld" />
> </beans>
> -----------------------------------------------------------------------------------------------------------------------
> =================HelloWorld.java=======================================
> package demo.spring;
> import javax.jws.WebService;
> import javax.jws.WebMethod;
> import javax.jws.WebParam;
> import javax.jws.WebResult;
> import javax.xml.ws.ResponseWrapper;
> import javax.xml.ws.RequestWrapper;
> import javax.jws.soap.SOAPBinding;
> @WebService(name="MyHelloWorldService", targetNamespace="http://nstest.helloworld")
> @SOAPBinding(	parameterStyle=SOAPBinding.ParameterStyle.WRAPPED,
> 				style=SOAPBinding.Style.DOCUMENT,
> 				use= SOAPBinding.Use.LITERAL	)
> public interface HelloWorld {
> 	@WebMethod
> 	@WebResult(name="MyResult", targetNamespace="http://nstest.helloworld")
>     String sayHi(@WebParam(name="MyInput", targetNamespace="http://nstest.helloworld") String text);
> }
> -----------------------------------------------------------------------------------------------------------------------
> =================HelloWorldImpl.java=======================================
> package demo.spring;
> import javax.jws.WebService;
> import javax.jws.soap.SOAPBinding;
> @WebService(endpointInterface = "demo.spring.HelloWorld")
> public class HelloWorldImpl implements HelloWorld {
>     public String sayHi(String text) {
>         return "Hello " + text;
>     }
> }
> -----------------------------------------------------------------------------------------------------------------------
> Create WAR from the above code, deploy to tomcat, here is the WSDL I got from http://localhost:8080/...::
> =======main WSDL: http://localhost:8080/spring_http/HelloWorld?wsdl=================
> <?xml version="1.0" encoding="utf-8" ?> 
> - <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://nstest.helloworld" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://spring.demo/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="HelloWorldImplService" targetNamespace="http://spring.demo/">
>   <wsdl:import location="http://localhost:8080/spring_http/HelloWorld?wsdl=MyHelloWorldService.wsdl" namespace="http://nstest.helloworld" /> 
> - <wsdl:binding name="HelloWorldImplServiceSoapBinding" type="ns1:MyHelloWorldService">
>   <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> 
> - <wsdl:operation name="sayHi">
>   <soap:operation soapAction="" style="document" /> 
> - <wsdl:input name="sayHi">
>   <soap:body use="literal" /> 
>   </wsdl:input>
> - <wsdl:output name="sayHiResponse">
>   <soap:body use="literal" /> 
>   </wsdl:output>
>   </wsdl:operation>
>   </wsdl:binding>
> - <wsdl:service name="HelloWorldImplService">
> - <wsdl:port binding="tns:HelloWorldImplServiceSoapBinding" name="HelloWorldImplPort">
>   <soap:address location="http://localhost:8080/spring_http/HelloWorld" /> 
>   </wsdl:port>
>   </wsdl:service>
>   </wsdl:definitions>
> -----------------------------------------------------------------------------------------------------------------------------------------------
> =====imported WSDL: http://localhost:8080/spring_http/HelloWorld?wsdl=MyHelloWorldService.wsdl====
> <?xml version="1.0" encoding="utf-8" ?> 
> - <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://nstest.helloworld" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="MyHelloWorldService" targetNamespace="http://nstest.helloworld">
> - <wsdl:types>
> - <xsd:schema xmlns="http://nstest.helloworld" xmlns:tns="http://spring.demo/" attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://nstest.helloworld" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>   <import xmlns="http://www.w3.org/2001/XMLSchema" namespace="http://spring.demo/" /> 
>   <xsd:element name="sayHi" type="sayHi" /> 
> - <xsd:complexType name="sayHi">
> - <xsd:sequence>
>   <xsd:element minOccurs="0" name="MyInput" type="xsd:string" /> 
>   </xsd:sequence>
>   </xsd:complexType>
>   <xsd:element name="sayHiResponse" type="sayHiResponse" /> 
> - <xsd:complexType name="sayHiResponse">
> - <xsd:sequence>
>   <xsd:element minOccurs="0" name="MyResult" type="xsd:string" /> 
>   </xsd:sequence>
>   </xsd:complexType>
>   </xsd:schema>
>   </wsdl:types>
> - <wsdl:message name="sayHi">
>   <wsdl:part element="ns1:sayHi" name="parameters" /> 
>   </wsdl:message>
> - <wsdl:message name="sayHiResponse">
>   <wsdl:part element="ns1:sayHiResponse" name="parameters" /> 
>   </wsdl:message>
> - <wsdl:portType name="MyHelloWorldService">
> - <wsdl:operation name="sayHi">
>   <wsdl:input message="ns1:sayHi" name="sayHi" /> 
>   <wsdl:output message="ns1:sayHiResponse" name="sayHiResponse" /> 
>   </wsdl:operation>
>   </wsdl:portType>
>   </wsdl:definitions>
> -------------------------------------------------------------------------------------------------------------------------------------------
> Create client from WSDL by using wsdl2java. The namespaces of input/output parameters have already been missing from the generated service interface:
> ================MyHelloWorldService.java (generated by wsdl2java)====================== 
> package helloworld.nstest;
> import javax.jws.WebParam.Mode;
> import javax.jws.WebParam;
> import javax.jws.WebService;
> import javax.jws.soap.SOAPBinding.Style;
> import javax.jws.soap.SOAPBinding;
> import javax.jws.WebMethod;
> import javax.jws.WebResult;
> import javax.xml.ws.RequestWrapper;
> import javax.xml.ws.ResponseWrapper;
> /**
>  * This class was generated by Apache CXF (incubator) 2.0.3-incubator
>  * Tue Nov 20 22:45:47 EST 2007
>  * Generated source version: 2.0.3-incubator
>  * 
>  */
> @WebService(targetNamespace = "http://nstest.helloworld", name = "MyHelloWorldService")
> public interface MyHelloWorldService {
>     @ResponseWrapper(targetNamespace = "http://nstest.helloworld", className = "helloworld.nstest.SayHiResponse", localName = "sayHiResponse")
>     @RequestWrapper(targetNamespace = "http://nstest.helloworld", className = "helloworld.nstest.SayHi", localName = "sayHi")
>     @WebResult(targetNamespace = "", name = "MyResult")
>     @WebMethod
>     public java.lang.String sayHi(
>         @WebParam(targetNamespace = "", name = "MyInput")
>         java.lang.String myInput
>     );
> }
> ===================================================================
> Modify the generated client:
> ========MyHelloWorldService_HelloWorldImplPort_Client.java (generated by wsdl2java)======
> package helloworld.nstest;
> import java.io.File;
> import java.net.MalformedURLException;
> import java.net.URL;
> import javax.xml.namespace.QName;
> import demo.spring.HelloWorldImplService;
> import javax.jws.WebMethod;
> import javax.jws.WebResult;
> import javax.xml.ws.RequestWrapper;
> import javax.xml.ws.ResponseWrapper;
> public final class MyHelloWorldService_HelloWorldImplPort_Client {
>     private static final QName SERVICE_NAME = new QName("http://spring.demo/", "HelloWorldImplService");
>     private MyHelloWorldService_HelloWorldImplPort_Client() {
>     }
>     public static void main(String args[]) throws Exception {
>       
>         HelloWorldImplService ss = new HelloWorldImplService();
>         MyHelloWorldService port = ss.getHelloWorldImplPort();     
>         {
>         System.out.println("Invoking sayHi...");
>         java.lang.String _sayHi_myInput = "ABC";
>         java.lang.String _sayHi__return = port.sayHi(_sayHi_myInput);
>         System.out.println("sayHi.result=" + _sayHi__return);
>         }
>         System.exit(0);
>     }
> }
> --------------------------------------------------------------------------------------------------------
> SOAP message captured on server-side:
> --------------------------------------
> Encoding: UTF-8
> Headers: {connection=[keep-alive], cache-control=[no-cache], host=[localhost:808
> 0], user-agent=[Java/1.5.0_12], transfer-encoding=[chunked], pragma=[no-cache],
> content-type=[text/xml; charset=UTF-8], accept=[*], soapaction=[""]}
> Message:
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body
> ><ns2:sayHi xmlns:ns2="http://nstest.helloworld"><MyInput>ABC</MyInput></ns2:say
> Hi></soap:Body></soap:Envelope>
> --------------------------------------
> Nov 20, 2007 10:51:13 PM org.apache.cxf.interceptor.LoggingOutInterceptor$Loggin
> gCallback onClose
> INFO: Outbound Message:
> --------------------------------------
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body
> ><ns1:sayHiResponse xmlns:ns1="http://nstest.helloworld"><MyResult>Hello ABC</My
> Result></ns1:sayHiResponse></soap:Body></soap:Envelope>-------------------------
> -------------
> You can see that both "MyInput" and "MyResult" have no namespace.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-1226) elementFormDefault from package-info.java ignored with JAXWS+JAXB when there are no beans

Posted by "Benson Margulies (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-1226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12547248 ] 

Benson Margulies commented on CXF-1226:
---------------------------------------

Dan,

I thought that you told me that automatically generating wrappers was a CXF extension over and above JAX-WS. So, in that case, how can it be a TCK violation to respect a JAXB package-info.java?

> elementFormDefault from package-info.java ignored with JAXWS+JAXB when there are no beans
> -----------------------------------------------------------------------------------------
>
>                 Key: CXF-1226
>                 URL: https://issues.apache.org/jira/browse/CXF-1226
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.0.2, 2.0.3
>         Environment: Windows XP; Tomcat 5.5
>            Reporter: Nianhua Li
>            Assignee: Benson Margulies
>             Fix For: 2.0.3
>
>
> I am using the java-first approach with spring configuration on cxf 2.0.3 and tomcat 5.5. I specified namespace for all the input and output parameters via @WebParam and @WebResult annotation. But the namespace was somehow missing from the SOAP message.
> You can reproduce the problem by using the following test code (server side):
> =================web.xml========================================
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <!DOCTYPE web-app
>     PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
>     "http://java.sun.com/dtd/web-app_2_3.dtd">
> <web-app>
> 	<context-param>
> 		<param-name>contextConfigLocation</param-name>
> 		<param-value>WEB-INF/beans.xml</param-value>
> 	</context-param>
> 	<listener>
> 		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
> 	</listener>
> 	<servlet>
> 		<servlet-name>CXFServlet</servlet-name>
> 		<display-name>CXF Servlet</display-name>
> 		<servlet-class>
> 			org.apache.cxf.transport.servlet.CXFServlet
> 		</servlet-class>
> 		<load-on-startup>1</load-on-startup>
> 	</servlet>
> 	<servlet-mapping>
> 		<servlet-name>CXFServlet</servlet-name>
> 		<url-pattern>/*</url-pattern>
> 	</servlet-mapping>
> </web-app>
> ---------------------------------------------------------------------------------------------------------------
> =================beans.xml=======================================
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 	xmlns:jaxws="http://cxf.apache.org/jaxws"
> 	xmlns:cxf="http://cxf.apache.org/core"
> 	xsi:schemaLocation="
> http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
> http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
> http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
> 	<import resource="classpath:META-INF/cxf/cxf.xml" />
> 	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
> 	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
>     <bean id="logInbound" class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
>     <bean id="logOutbound" class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
>     <cxf:bus>
>         <cxf:inInterceptors> <ref bean="logInbound"/>  </cxf:inInterceptors>
>         <cxf:outInterceptors> <ref bean="logOutbound"/> </cxf:outInterceptors>
>         <cxf:inFaultInterceptors>  <ref bean="logOutbound"/>  </cxf:inFaultInterceptors>
>     </cxf:bus> 
>     <jaxws:endpoint   id="helloWorld"  implementor="demo.spring.HelloWorldImpl" 	  address="/HelloWorld" />
> </beans>
> -----------------------------------------------------------------------------------------------------------------------
> =================HelloWorld.java=======================================
> package demo.spring;
> import javax.jws.WebService;
> import javax.jws.WebMethod;
> import javax.jws.WebParam;
> import javax.jws.WebResult;
> import javax.xml.ws.ResponseWrapper;
> import javax.xml.ws.RequestWrapper;
> import javax.jws.soap.SOAPBinding;
> @WebService(name="MyHelloWorldService", targetNamespace="http://nstest.helloworld")
> @SOAPBinding(	parameterStyle=SOAPBinding.ParameterStyle.WRAPPED,
> 				style=SOAPBinding.Style.DOCUMENT,
> 				use= SOAPBinding.Use.LITERAL	)
> public interface HelloWorld {
> 	@WebMethod
> 	@WebResult(name="MyResult", targetNamespace="http://nstest.helloworld")
>     String sayHi(@WebParam(name="MyInput", targetNamespace="http://nstest.helloworld") String text);
> }
> -----------------------------------------------------------------------------------------------------------------------
> =================HelloWorldImpl.java=======================================
> package demo.spring;
> import javax.jws.WebService;
> import javax.jws.soap.SOAPBinding;
> @WebService(endpointInterface = "demo.spring.HelloWorld")
> public class HelloWorldImpl implements HelloWorld {
>     public String sayHi(String text) {
>         return "Hello " + text;
>     }
> }
> -----------------------------------------------------------------------------------------------------------------------
> Create WAR from the above code, deploy to tomcat, here is the WSDL I got from http://localhost:8080/...::
> =======main WSDL: http://localhost:8080/spring_http/HelloWorld?wsdl=================
> <?xml version="1.0" encoding="utf-8" ?> 
> - <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://nstest.helloworld" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://spring.demo/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="HelloWorldImplService" targetNamespace="http://spring.demo/">
>   <wsdl:import location="http://localhost:8080/spring_http/HelloWorld?wsdl=MyHelloWorldService.wsdl" namespace="http://nstest.helloworld" /> 
> - <wsdl:binding name="HelloWorldImplServiceSoapBinding" type="ns1:MyHelloWorldService">
>   <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> 
> - <wsdl:operation name="sayHi">
>   <soap:operation soapAction="" style="document" /> 
> - <wsdl:input name="sayHi">
>   <soap:body use="literal" /> 
>   </wsdl:input>
> - <wsdl:output name="sayHiResponse">
>   <soap:body use="literal" /> 
>   </wsdl:output>
>   </wsdl:operation>
>   </wsdl:binding>
> - <wsdl:service name="HelloWorldImplService">
> - <wsdl:port binding="tns:HelloWorldImplServiceSoapBinding" name="HelloWorldImplPort">
>   <soap:address location="http://localhost:8080/spring_http/HelloWorld" /> 
>   </wsdl:port>
>   </wsdl:service>
>   </wsdl:definitions>
> -----------------------------------------------------------------------------------------------------------------------------------------------
> =====imported WSDL: http://localhost:8080/spring_http/HelloWorld?wsdl=MyHelloWorldService.wsdl====
> <?xml version="1.0" encoding="utf-8" ?> 
> - <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://nstest.helloworld" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="MyHelloWorldService" targetNamespace="http://nstest.helloworld">
> - <wsdl:types>
> - <xsd:schema xmlns="http://nstest.helloworld" xmlns:tns="http://spring.demo/" attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://nstest.helloworld" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>   <import xmlns="http://www.w3.org/2001/XMLSchema" namespace="http://spring.demo/" /> 
>   <xsd:element name="sayHi" type="sayHi" /> 
> - <xsd:complexType name="sayHi">
> - <xsd:sequence>
>   <xsd:element minOccurs="0" name="MyInput" type="xsd:string" /> 
>   </xsd:sequence>
>   </xsd:complexType>
>   <xsd:element name="sayHiResponse" type="sayHiResponse" /> 
> - <xsd:complexType name="sayHiResponse">
> - <xsd:sequence>
>   <xsd:element minOccurs="0" name="MyResult" type="xsd:string" /> 
>   </xsd:sequence>
>   </xsd:complexType>
>   </xsd:schema>
>   </wsdl:types>
> - <wsdl:message name="sayHi">
>   <wsdl:part element="ns1:sayHi" name="parameters" /> 
>   </wsdl:message>
> - <wsdl:message name="sayHiResponse">
>   <wsdl:part element="ns1:sayHiResponse" name="parameters" /> 
>   </wsdl:message>
> - <wsdl:portType name="MyHelloWorldService">
> - <wsdl:operation name="sayHi">
>   <wsdl:input message="ns1:sayHi" name="sayHi" /> 
>   <wsdl:output message="ns1:sayHiResponse" name="sayHiResponse" /> 
>   </wsdl:operation>
>   </wsdl:portType>
>   </wsdl:definitions>
> -------------------------------------------------------------------------------------------------------------------------------------------
> Create client from WSDL by using wsdl2java. The namespaces of input/output parameters have already been missing from the generated service interface:
> ================MyHelloWorldService.java (generated by wsdl2java)====================== 
> package helloworld.nstest;
> import javax.jws.WebParam.Mode;
> import javax.jws.WebParam;
> import javax.jws.WebService;
> import javax.jws.soap.SOAPBinding.Style;
> import javax.jws.soap.SOAPBinding;
> import javax.jws.WebMethod;
> import javax.jws.WebResult;
> import javax.xml.ws.RequestWrapper;
> import javax.xml.ws.ResponseWrapper;
> /**
>  * This class was generated by Apache CXF (incubator) 2.0.3-incubator
>  * Tue Nov 20 22:45:47 EST 2007
>  * Generated source version: 2.0.3-incubator
>  * 
>  */
> @WebService(targetNamespace = "http://nstest.helloworld", name = "MyHelloWorldService")
> public interface MyHelloWorldService {
>     @ResponseWrapper(targetNamespace = "http://nstest.helloworld", className = "helloworld.nstest.SayHiResponse", localName = "sayHiResponse")
>     @RequestWrapper(targetNamespace = "http://nstest.helloworld", className = "helloworld.nstest.SayHi", localName = "sayHi")
>     @WebResult(targetNamespace = "", name = "MyResult")
>     @WebMethod
>     public java.lang.String sayHi(
>         @WebParam(targetNamespace = "", name = "MyInput")
>         java.lang.String myInput
>     );
> }
> ===================================================================
> Modify the generated client:
> ========MyHelloWorldService_HelloWorldImplPort_Client.java (generated by wsdl2java)======
> package helloworld.nstest;
> import java.io.File;
> import java.net.MalformedURLException;
> import java.net.URL;
> import javax.xml.namespace.QName;
> import demo.spring.HelloWorldImplService;
> import javax.jws.WebMethod;
> import javax.jws.WebResult;
> import javax.xml.ws.RequestWrapper;
> import javax.xml.ws.ResponseWrapper;
> public final class MyHelloWorldService_HelloWorldImplPort_Client {
>     private static final QName SERVICE_NAME = new QName("http://spring.demo/", "HelloWorldImplService");
>     private MyHelloWorldService_HelloWorldImplPort_Client() {
>     }
>     public static void main(String args[]) throws Exception {
>       
>         HelloWorldImplService ss = new HelloWorldImplService();
>         MyHelloWorldService port = ss.getHelloWorldImplPort();     
>         {
>         System.out.println("Invoking sayHi...");
>         java.lang.String _sayHi_myInput = "ABC";
>         java.lang.String _sayHi__return = port.sayHi(_sayHi_myInput);
>         System.out.println("sayHi.result=" + _sayHi__return);
>         }
>         System.exit(0);
>     }
> }
> --------------------------------------------------------------------------------------------------------
> SOAP message captured on server-side:
> --------------------------------------
> Encoding: UTF-8
> Headers: {connection=[keep-alive], cache-control=[no-cache], host=[localhost:808
> 0], user-agent=[Java/1.5.0_12], transfer-encoding=[chunked], pragma=[no-cache],
> content-type=[text/xml; charset=UTF-8], accept=[*], soapaction=[""]}
> Message:
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body
> ><ns2:sayHi xmlns:ns2="http://nstest.helloworld"><MyInput>ABC</MyInput></ns2:say
> Hi></soap:Body></soap:Envelope>
> --------------------------------------
> Nov 20, 2007 10:51:13 PM org.apache.cxf.interceptor.LoggingOutInterceptor$Loggin
> gCallback onClose
> INFO: Outbound Message:
> --------------------------------------
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body
> ><ns1:sayHiResponse xmlns:ns1="http://nstest.helloworld"><MyResult>Hello ABC</My
> Result></ns1:sayHiResponse></soap:Body></soap:Envelope>-------------------------
> -------------
> You can see that both "MyInput" and "MyResult" have no namespace.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.