Author: scheu Date: Mon Mar 29 19:08:34 2010 New Revision: 928871 URL: http://svn.apache.org/viewvc?rev=928871&view=rev Log: (empty)
Modified: axis/axis2/java/core/trunk/modules/jaxws-integration/test-resources/wsdl/doclitbare.wsdl axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/BareTests.java axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/doclitbare/DocLitBarePortTypeImpl.java axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/doclitbare/META-INF/doclitbare.wsdl axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/doclitbare/sei/DocLitBarePortType.java axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/Constants.java axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/JAXWSProxyHandler.java axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/MethodMarshaller.java axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitBareMethodMarshaller.java axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitBareMinimalMethodMarshaller.java axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedMethodMarshaller.java axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedMinimalMethodMarshaller.java axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedPlusMethodMarshaller.java axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/MethodMarshallerUtils.java axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/RPCLitMethodMarshaller.java Modified: axis/axis2/java/core/trunk/modules/jaxws-integration/test-resources/wsdl/doclitbare.wsdl URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/test-resources/wsdl/doclitbare.wsdl?rev=928871&r1=928870&r2=928871&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/jaxws-integration/test-resources/wsdl/doclitbare.wsdl (original) +++ axis/axis2/java/core/trunk/modules/jaxws-integration/test-resources/wsdl/doclitbare.wsdl Mon Mar 29 19:08:34 2010 @@ -20,173 +20,196 @@ --> <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" - xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" - xmlns:tns="http://doclitbare.sample.test.org" - xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="DoclitBare" - targetNamespace="http://doclitbare.sample.test.org"> - - <wsdl:types> - <xsd:schema - targetNamespace="http://doclitbare.sample.test.org" - xmlns:tns="http://doclitbare.sample.test.org" - xmlns:xsd="http://www.w3.org/2001/XMLSchema"> - - <xsd:element name="String" type="xsd:string" /> - <xsd:element name="Integer" type="xsd:int" /> - - <xsd:element name="Composite"> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="myElement" type="xsd:string" /> - </xsd:sequence> - </xsd:complexType> - </xsd:element> - - <!-- basic fault test, this should be mapped into message part - of the generated faultBean - --> - <xsd:element name="MyFault" type="xsd:string" /> - - <!-- wrapper exception and polymorphic fault test - This bean should have an associated exception - --> - <xsd:element name="MyBaseFaultBean" type="tns:BaseFault" /> - - <xsd:complexType name="BaseFault"> - <xsd:sequence> - <xsd:element name="message" type="xsd:string" /> - <xsd:element name="error_code" type="xsd:int" /> - </xsd:sequence> - </xsd:complexType> - - <xsd:complexType name="ExtendedFault"> - <xsd:complexContent> - <xsd:extension base="tns:BaseFault"> - <xsd:sequence> - <xsd:element name="another_message" type="xsd:string" /> - <xsd:element name="another_error_code" type="xsd:int" /> - </xsd:sequence> + xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns:tns="http://doclitbare.sample.test.org" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="DoclitBare" + targetNamespace="http://doclitbare.sample.test.org"> + + <wsdl:types> + <xsd:schema + targetNamespace="http://doclitbare.sample.test.org" + xmlns:tns="http://doclitbare.sample.test.org" + xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + + <xsd:element name="String" type="xsd:string" /> + <xsd:element name="Integer" type="xsd:int" /> + + <xsd:element name="HeaderString" type="xsd:string" /> + <xsd:element name="BodyInteger" type="xsd:int" /> + + <xsd:element name="Composite"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="myElement" type="xsd:string" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + + <!-- basic fault test, this should be mapped into message part + of the generated faultBean + --> + <xsd:element name="MyFault" type="xsd:string" /> + + <!-- wrapper exception and polymorphic fault test + This bean should have an associated exception + --> + <xsd:element name="MyBaseFaultBean" type="tns:BaseFault" /> + + <xsd:complexType name="BaseFault"> + <xsd:sequence> + <xsd:element name="message" type="xsd:string" /> + <xsd:element name="error_code" type="xsd:int" /> + </xsd:sequence> + </xsd:complexType> + + <xsd:complexType name="ExtendedFault"> + <xsd:complexContent> + <xsd:extension base="tns:BaseFault"> + <xsd:sequence> + <xsd:element name="another_message" type="xsd:string" /> + <xsd:element name="another_error_code" type="xsd:int" /> + </xsd:sequence> </xsd:extension> - </xsd:complexContent> - </xsd:complexType> + </xsd:complexContent> + </xsd:complexType> - </xsd:schema> - </wsdl:types> + </xsd:schema> + </wsdl:types> - <wsdl:message name="NoParam" /> + <wsdl:message name="NoParam" /> - <wsdl:message name="echoStringIn"> - <wsdl:part name="echoStringIn" element="tns:String" /> - </wsdl:message> - - <wsdl:message name="echoStringOut"> - <wsdl:part name="echoStringOut" element="tns:String" /> - </wsdl:message> - - <wsdl:message name="SingleParam"> - <wsdl:part name="allByMyself" element="tns:String" /> - </wsdl:message> - - <wsdl:message name="SingleParamInt"> - <wsdl:part name="allByMyself" element="tns:Integer" /> - </wsdl:message> - - <wsdl:message name="SingleParamOther"> - <wsdl:part name="allByMyself" element="tns:Composite" /> - </wsdl:message> - - <wsdl:message name="SimpleFault"> - <wsdl:part name="description" element="tns:MyFault" /> - </wsdl:message> - - <wsdl:message name="FaultBeanWithWrapper"> - <wsdl:part name="description" element="tns:MyBaseFaultBean" /> - </wsdl:message> - - <wsdl:portType name="DocLitBarePortType"> - - <wsdl:operation name="oneWayEmpty"> - <wsdl:input message="tns:NoParam" /> - </wsdl:operation> - - <wsdl:operation name="oneWay"> - <wsdl:input message="tns:SingleParam" /> - </wsdl:operation> - - <wsdl:operation name="echoString"> - <wsdl:input message="tns:echoStringIn" /> - <wsdl:output message="tns:echoStringOut" /> - </wsdl:operation> - - <wsdl:operation name="twoWaySimple"> - <wsdl:input message="tns:SingleParamInt" /> - <wsdl:output message="tns:SingleParam" /> - </wsdl:operation> - - <wsdl:operation name="twoWayHolder"> - <wsdl:input message="tns:SingleParamOther" /> - <wsdl:output message="tns:SingleParamOther" /> - <wsdl:fault message="tns:SimpleFault" name="twoWayFault"/> - <wsdl:fault message="tns:FaultBeanWithWrapper" name="wrapperFault"/> - </wsdl:operation> - - </wsdl:portType> - - <wsdl:binding name="DocLitBare" type="tns:DocLitBarePortType"> - <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> - - <wsdl:operation name="oneWayEmpty"> - <wsdl:input> - <soap:body use="literal" /> - </wsdl:input> - </wsdl:operation> - - <wsdl:operation name="oneWay"> - <wsdl:input> - <soap:body use="literal" /> - </wsdl:input> - </wsdl:operation> - - <wsdl:operation name="echoString"> - <wsdl:input> - <soap:body use="literal" /> - </wsdl:input> - <wsdl:output> - <soap:body use="literal" /> - </wsdl:output> - </wsdl:operation> - - <wsdl:operation name="twoWaySimple"> - <wsdl:input> - <soap:body use="literal" /> - </wsdl:input> - <wsdl:output> - <soap:body use="literal" /> - </wsdl:output> - </wsdl:operation> - - <wsdl:operation name="twoWayHolder"> - <wsdl:input> - <soap:body use="literal" /> - </wsdl:input> - <wsdl:output> - <soap:body use="literal" /> - </wsdl:output> - <wsdl:fault name="twoWayFault"> - <soap:fault use="literal" name="twoWayFault" /> - </wsdl:fault> - <wsdl:fault name="wrapperFault"> - <soap:fault use="literal" name="wrapperFault" /> - </wsdl:fault> - </wsdl:operation> - - - </wsdl:binding> - - <wsdl:service name="BareDocLitService"> - <wsdl:port binding="tns:DocLitBare" name="BareDocLitPort"> - <soap:address location="http://localhost:6060/axis2/services/BareDocLitService" /> - </wsdl:port> - </wsdl:service> - -</wsdl:definitions> + <wsdl:message name="echoStringIn"> + <wsdl:part name="echoStringIn" element="tns:String" /> + </wsdl:message> + + <wsdl:message name="echoStringOut"> + <wsdl:part name="echoStringOut" element="tns:String" /> + </wsdl:message> + + <wsdl:message name="SingleParam"> + <wsdl:part name="allByMyself" element="tns:String" /> + </wsdl:message> + + <wsdl:message name="HeadersMsg"> + <wsdl:part name="bodyParam" element="tns:BodyInteger" /> + <wsdl:part name="headerParam" element="tns:HeaderString" /> + </wsdl:message> + + <wsdl:message name="SingleParamInt"> + <wsdl:part name="allByMyself" element="tns:Integer" /> + </wsdl:message> + + <wsdl:message name="SingleParamOther"> + <wsdl:part name="allByMyself" element="tns:Composite" /> + </wsdl:message> + + <wsdl:message name="SimpleFault"> + <wsdl:part name="description" element="tns:MyFault" /> + </wsdl:message> + + <wsdl:message name="FaultBeanWithWrapper"> + <wsdl:part name="description" element="tns:MyBaseFaultBean" /> + </wsdl:message> + + <wsdl:portType name="DocLitBarePortType"> + + <wsdl:operation name="oneWayEmpty"> + <wsdl:input message="tns:NoParam" /> + </wsdl:operation> + + <wsdl:operation name="oneWay"> + <wsdl:input message="tns:SingleParam" /> + </wsdl:operation> + + <wsdl:operation name="echoString"> + <wsdl:input message="tns:echoStringIn" /> + <wsdl:output message="tns:echoStringOut" /> + </wsdl:operation> + + <wsdl:operation name="twoWaySimple"> + <wsdl:input message="tns:SingleParamInt" /> + <wsdl:output message="tns:SingleParam" /> + </wsdl:operation> + + <wsdl:operation name="twoWayHolder"> + <wsdl:input message="tns:SingleParamOther" /> + <wsdl:output message="tns:SingleParamOther" /> + <wsdl:fault message="tns:SimpleFault" name="twoWayFault"/> + <wsdl:fault message="tns:FaultBeanWithWrapper" name="wrapperFault"/> + </wsdl:operation> + + <wsdl:operation name="headerTest"> + <wsdl:input message="tns:HeadersMsg" /> + <wsdl:output message="tns:SingleParam" /> + </wsdl:operation> + + </wsdl:portType> + + <wsdl:binding name="DocLitBare" type="tns:DocLitBarePortType"> + <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> + + <wsdl:operation name="oneWayEmpty"> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + </wsdl:operation> + + <wsdl:operation name="oneWay"> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + </wsdl:operation> + + <wsdl:operation name="echoString"> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + </wsdl:operation> + + <wsdl:operation name="twoWaySimple"> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + </wsdl:operation> + + <wsdl:operation name="twoWayHolder"> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + <wsdl:fault name="twoWayFault"> + <soap:fault use="literal" name="twoWayFault" /> + </wsdl:fault> + <wsdl:fault name="wrapperFault"> + <soap:fault use="literal" name="wrapperFault" /> + </wsdl:fault> + </wsdl:operation> + + <wsdl:operation name="headerTest"> + <wsdl:input> + <soap:body parts="bodyParam" use="literal" message="tns:HeadersMsg"/> + <soap:header part="headerParam" use="literal" message="tns:HeadersMsg" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + </wsdl:operation> + + + </wsdl:binding> + + <wsdl:service name="BareDocLitService"> + <wsdl:port binding="tns:DocLitBare" name="BareDocLitPort"> + <soap:address location="http://localhost:6060/axis2/services/BareDocLitService" /> + </wsdl:port> + </wsdl:service> + +</wsdl:definitions> \ No newline at end of file Modified: axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/BareTests.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/BareTests.java?rev=928871&r1=928870&r2=928871&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/BareTests.java (original) +++ axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/BareTests.java Mon Mar 29 19:08:34 2010 @@ -26,6 +26,7 @@ import junit.framework.Test; import junit.framework.TestSuite; import org.apache.axis2.jaxws.TestLogger; import org.apache.axis2.jaxws.framework.AbstractTestCase; +import org.apache.axis2.jaxws.marshaller.impl.alt.MethodMarshallerUtils; import org.apache.axis2.jaxws.sample.doclitbare.sei.BareDocLitService; import org.apache.axis2.jaxws.sample.doclitbare.sei.DocLitBarePortType; @@ -175,4 +176,64 @@ public class BareTests extends AbstractT fail(); } } + + public void testHeader() throws Exception { + TestLogger.logger.debug("------------------------------"); + TestLogger.logger.debug("Test : " + getName()); + + + BareDocLitService service = new BareDocLitService(); + DocLitBarePortType proxy = service.getBareDocLitPort(); + BindingProvider p = (BindingProvider) proxy; + p.getRequestContext().put( + BindingProvider.SOAPACTION_USE_PROPERTY, Boolean.TRUE); + p.getRequestContext().put( + BindingProvider.SOAPACTION_URI_PROPERTY, "headerTest"); + p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, ENDPOINT_URL); + + String request = "Hello World"; + String response = proxy.headerTest(1, request); + assertTrue(response != null); + assertTrue(response.indexOf(request) > 0); + + // Try the test again + request = "Hello World"; + response = proxy.headerTest(1,request); + assertTrue(response != null); + assertTrue(response.indexOf(request) > 0); + + TestLogger.logger.debug("------------------------------"); + + } + + public void testHeaderWithNull() throws Exception { + TestLogger.logger.debug("------------------------------"); + TestLogger.logger.debug("Test : " + getName()); + + + BareDocLitService service = new BareDocLitService(); + DocLitBarePortType proxy = service.getBareDocLitPort(); + BindingProvider p = (BindingProvider) proxy; + p.getRequestContext().put( + BindingProvider.SOAPACTION_USE_PROPERTY, Boolean.TRUE); + p.getRequestContext().put( + BindingProvider.SOAPACTION_URI_PROPERTY, "headerTest"); + p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, ENDPOINT_URL); + + // Don't write a header element when the @WebParam header parameter is null. + p.getRequestContext().put(org.apache.axis2.jaxws.Constants.WRITE_HEADER_ELEMENT_IF_NULL, Boolean.FALSE); + + String request = null; // No header + String response = proxy.headerTest(1, request); + assertTrue(response != null); + assertTrue(response.indexOf("No Header") > 0); + + // Try the test again + request = null; + response = proxy.headerTest(1,request); + assertTrue(response != null); + assertTrue(response.indexOf("No Header") > 0); + + TestLogger.logger.debug("------------------------------"); + } } Modified: axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/doclitbare/DocLitBarePortTypeImpl.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/doclitbare/DocLitBarePortTypeImpl.java?rev=928871&r1=928870&r2=928871&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/doclitbare/DocLitBarePortTypeImpl.java (original) +++ axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/doclitbare/DocLitBarePortTypeImpl.java Mon Mar 29 19:08:34 2010 @@ -75,5 +75,16 @@ public class DocLitBarePortTypeImpl impl throws FaultBeanWithWrapper, SimpleFault{ } + + public String headerTest( + int allByMyself, + String headerParam) { + if (headerParam == null) { + return "Acknowledgement: No Header"; + } else { + return "Acknowledgement: Header is " + headerParam; + } + + } } Modified: axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/doclitbare/META-INF/doclitbare.wsdl URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/doclitbare/META-INF/doclitbare.wsdl?rev=928871&r1=928870&r2=928871&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/doclitbare/META-INF/doclitbare.wsdl (original) +++ axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/doclitbare/META-INF/doclitbare.wsdl Mon Mar 29 19:08:34 2010 @@ -20,173 +20,196 @@ --> <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" - xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" - xmlns:tns="http://doclitbare.sample.test.org" - xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="DoclitBare" - targetNamespace="http://doclitbare.sample.test.org"> - - <wsdl:types> - <xsd:schema - targetNamespace="http://doclitbare.sample.test.org" - xmlns:tns="http://doclitbare.sample.test.org" - xmlns:xsd="http://www.w3.org/2001/XMLSchema"> - - <xsd:element name="String" type="xsd:string" /> - <xsd:element name="Integer" type="xsd:int" /> - - <xsd:element name="Composite"> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="myElement" type="xsd:string" /> - </xsd:sequence> - </xsd:complexType> - </xsd:element> - - <!-- basic fault test, this should be mapped into message part - of the generated faultBean - --> - <xsd:element name="MyFault" type="xsd:string" /> - - <!-- wrapper exception and polymorphic fault test - This bean should have an associated exception - --> - <xsd:element name="MyBaseFaultBean" type="tns:BaseFault" /> - - <xsd:complexType name="BaseFault"> - <xsd:sequence> - <xsd:element name="message" type="xsd:string" /> - <xsd:element name="error_code" type="xsd:int" /> - </xsd:sequence> - </xsd:complexType> - - <xsd:complexType name="ExtendedFault"> - <xsd:complexContent> - <xsd:extension base="tns:BaseFault"> - <xsd:sequence> - <xsd:element name="another_message" type="xsd:string" /> - <xsd:element name="another_error_code" type="xsd:int" /> - </xsd:sequence> + xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns:tns="http://doclitbare.sample.test.org" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="DoclitBare" + targetNamespace="http://doclitbare.sample.test.org"> + + <wsdl:types> + <xsd:schema + targetNamespace="http://doclitbare.sample.test.org" + xmlns:tns="http://doclitbare.sample.test.org" + xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + + <xsd:element name="String" type="xsd:string" /> + <xsd:element name="Integer" type="xsd:int" /> + + <xsd:element name="HeaderString" type="xsd:string" /> + <xsd:element name="BodyInteger" type="xsd:int" /> + + <xsd:element name="Composite"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="myElement" type="xsd:string" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + + <!-- basic fault test, this should be mapped into message part + of the generated faultBean + --> + <xsd:element name="MyFault" type="xsd:string" /> + + <!-- wrapper exception and polymorphic fault test + This bean should have an associated exception + --> + <xsd:element name="MyBaseFaultBean" type="tns:BaseFault" /> + + <xsd:complexType name="BaseFault"> + <xsd:sequence> + <xsd:element name="message" type="xsd:string" /> + <xsd:element name="error_code" type="xsd:int" /> + </xsd:sequence> + </xsd:complexType> + + <xsd:complexType name="ExtendedFault"> + <xsd:complexContent> + <xsd:extension base="tns:BaseFault"> + <xsd:sequence> + <xsd:element name="another_message" type="xsd:string" /> + <xsd:element name="another_error_code" type="xsd:int" /> + </xsd:sequence> </xsd:extension> - </xsd:complexContent> - </xsd:complexType> + </xsd:complexContent> + </xsd:complexType> - </xsd:schema> - </wsdl:types> + </xsd:schema> + </wsdl:types> - <wsdl:message name="NoParam" /> + <wsdl:message name="NoParam" /> - <wsdl:message name="echoStringIn"> - <wsdl:part name="echoStringIn" element="tns:String" /> - </wsdl:message> - - <wsdl:message name="echoStringOut"> - <wsdl:part name="echoStringOut" element="tns:String" /> - </wsdl:message> - - <wsdl:message name="SingleParam"> - <wsdl:part name="allByMyself" element="tns:String" /> - </wsdl:message> - - <wsdl:message name="SingleParamInt"> - <wsdl:part name="allByMyself" element="tns:Integer" /> - </wsdl:message> - - <wsdl:message name="SingleParamOther"> - <wsdl:part name="allByMyself" element="tns:Composite" /> - </wsdl:message> - - <wsdl:message name="SimpleFault"> - <wsdl:part name="description" element="tns:MyFault" /> - </wsdl:message> - - <wsdl:message name="FaultBeanWithWrapper"> - <wsdl:part name="description" element="tns:MyBaseFaultBean" /> - </wsdl:message> - - <wsdl:portType name="DocLitBarePortType"> - - <wsdl:operation name="oneWayEmpty"> - <wsdl:input message="tns:NoParam" /> - </wsdl:operation> - - <wsdl:operation name="oneWay"> - <wsdl:input message="tns:SingleParam" /> - </wsdl:operation> - - <wsdl:operation name="echoString"> - <wsdl:input message="tns:echoStringIn" /> - <wsdl:output message="tns:echoStringOut" /> - </wsdl:operation> - - <wsdl:operation name="twoWaySimple"> - <wsdl:input message="tns:SingleParamInt" /> - <wsdl:output message="tns:SingleParam" /> - </wsdl:operation> - - <wsdl:operation name="twoWayHolder"> - <wsdl:input message="tns:SingleParamOther" /> - <wsdl:output message="tns:SingleParamOther" /> - <wsdl:fault message="tns:SimpleFault" name="twoWayFault"/> - <wsdl:fault message="tns:FaultBeanWithWrapper" name="wrapperFault"/> - </wsdl:operation> - - </wsdl:portType> - - <wsdl:binding name="DocLitBare" type="tns:DocLitBarePortType"> - <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> - - <wsdl:operation name="oneWayEmpty"> - <wsdl:input> - <soap:body use="literal" /> - </wsdl:input> - </wsdl:operation> - - <wsdl:operation name="oneWay"> - <wsdl:input> - <soap:body use="literal" /> - </wsdl:input> - </wsdl:operation> - - <wsdl:operation name="echoString"> - <wsdl:input> - <soap:body use="literal" /> - </wsdl:input> - <wsdl:output> - <soap:body use="literal" /> - </wsdl:output> - </wsdl:operation> - - <wsdl:operation name="twoWaySimple"> - <wsdl:input> - <soap:body use="literal" /> - </wsdl:input> - <wsdl:output> - <soap:body use="literal" /> - </wsdl:output> - </wsdl:operation> - - <wsdl:operation name="twoWayHolder"> - <wsdl:input> - <soap:body use="literal" /> - </wsdl:input> - <wsdl:output> - <soap:body use="literal" /> - </wsdl:output> - <wsdl:fault name="twoWayFault"> - <soap:fault use="literal" name="twoWayFault" /> - </wsdl:fault> - <wsdl:fault name="wrapperFault"> - <soap:fault use="literal" name="wrapperFault" /> - </wsdl:fault> - </wsdl:operation> - - - </wsdl:binding> - - <wsdl:service name="BareDocLitService"> - <wsdl:port binding="tns:DocLitBare" name="BareDocLitPort"> - <soap:address location="http://localhost:6060/axis2/services/BareDocLitService" /> - </wsdl:port> - </wsdl:service> - + <wsdl:message name="echoStringIn"> + <wsdl:part name="echoStringIn" element="tns:String" /> + </wsdl:message> + + <wsdl:message name="echoStringOut"> + <wsdl:part name="echoStringOut" element="tns:String" /> + </wsdl:message> + + <wsdl:message name="SingleParam"> + <wsdl:part name="allByMyself" element="tns:String" /> + </wsdl:message> + + <wsdl:message name="HeadersMsg"> + <wsdl:part name="bodyParam" element="tns:BodyInteger" /> + <wsdl:part name="headerParam" element="tns:HeaderString" /> + </wsdl:message> + + <wsdl:message name="SingleParamInt"> + <wsdl:part name="allByMyself" element="tns:Integer" /> + </wsdl:message> + + <wsdl:message name="SingleParamOther"> + <wsdl:part name="allByMyself" element="tns:Composite" /> + </wsdl:message> + + <wsdl:message name="SimpleFault"> + <wsdl:part name="description" element="tns:MyFault" /> + </wsdl:message> + + <wsdl:message name="FaultBeanWithWrapper"> + <wsdl:part name="description" element="tns:MyBaseFaultBean" /> + </wsdl:message> + + <wsdl:portType name="DocLitBarePortType"> + + <wsdl:operation name="oneWayEmpty"> + <wsdl:input message="tns:NoParam" /> + </wsdl:operation> + + <wsdl:operation name="oneWay"> + <wsdl:input message="tns:SingleParam" /> + </wsdl:operation> + + <wsdl:operation name="echoString"> + <wsdl:input message="tns:echoStringIn" /> + <wsdl:output message="tns:echoStringOut" /> + </wsdl:operation> + + <wsdl:operation name="twoWaySimple"> + <wsdl:input message="tns:SingleParamInt" /> + <wsdl:output message="tns:SingleParam" /> + </wsdl:operation> + + <wsdl:operation name="twoWayHolder"> + <wsdl:input message="tns:SingleParamOther" /> + <wsdl:output message="tns:SingleParamOther" /> + <wsdl:fault message="tns:SimpleFault" name="twoWayFault"/> + <wsdl:fault message="tns:FaultBeanWithWrapper" name="wrapperFault"/> + </wsdl:operation> + + <wsdl:operation name="headerTest"> + <wsdl:input message="tns:HeadersMsg" /> + <wsdl:output message="tns:SingleParam" /> + </wsdl:operation> + + </wsdl:portType> + + <wsdl:binding name="DocLitBare" type="tns:DocLitBarePortType"> + <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> + + <wsdl:operation name="oneWayEmpty"> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + </wsdl:operation> + + <wsdl:operation name="oneWay"> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + </wsdl:operation> + + <wsdl:operation name="echoString"> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + </wsdl:operation> + + <wsdl:operation name="twoWaySimple"> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + </wsdl:operation> + + <wsdl:operation name="twoWayHolder"> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + <wsdl:fault name="twoWayFault"> + <soap:fault use="literal" name="twoWayFault" /> + </wsdl:fault> + <wsdl:fault name="wrapperFault"> + <soap:fault use="literal" name="wrapperFault" /> + </wsdl:fault> + </wsdl:operation> + + <wsdl:operation name="headerTest"> + <wsdl:input> + <soap:body parts="bodyParam" use="literal" message="tns:HeadersMsg"/> + <soap:header part="headerParam" use="literal" message="tns:HeadersMsg" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + </wsdl:operation> + + + </wsdl:binding> + + <wsdl:service name="BareDocLitService"> + <wsdl:port binding="tns:DocLitBare" name="BareDocLitPort"> + <soap:address location="http://localhost:6060/axis2/services/BareDocLitService" /> + </wsdl:port> + </wsdl:service> + </wsdl:definitions> Modified: axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/doclitbare/sei/DocLitBarePortType.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/doclitbare/sei/DocLitBarePortType.java?rev=928871&r1=928870&r2=928871&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/doclitbare/sei/DocLitBarePortType.java (original) +++ axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/doclitbare/sei/DocLitBarePortType.java Mon Mar 29 19:08:34 2010 @@ -20,6 +20,8 @@ package org.apache.axis2.jaxws.sample.doclitbare.sei; +import org.apache.axis2.jaxws.sample.doclitbare.sei.FaultBeanWithWrapper; +import org.apache.axis2.jaxws.sample.doclitbare.sei.SimpleFault; import org.test.sample.doclitbare.Composite; import javax.jws.Oneway; @@ -93,4 +95,18 @@ public interface DocLitBarePortType { throws FaultBeanWithWrapper, SimpleFault ; + /** + * headerTest + * @param bodyParam + * @param headerParam + * @return allByMyself + */ + @WebMethod + @WebResult(name = "String", targetNamespace = "http://doclitbare.sample.test.org", partName = "allByMyself") + public String headerTest( + @WebParam(name = "BodyInteger", targetNamespace = "http://doclitbare.sample.test.org", partName = "bodyParam") + int allByMyself, + @WebParam(name = "HeaderString", targetNamespace = "http://doclitbare.sample.test.org", partName = "headerParam", header=true) + String headerParam) + ; } Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/Constants.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/Constants.java?rev=928871&r1=928870&r2=928871&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/Constants.java (original) +++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/Constants.java Mon Mar 29 19:08:34 2010 @@ -108,4 +108,22 @@ public interface Constants { * JAX-WS layer when a SOAP Fault is received on response. */ public static final String THROW_EXCEPTION_IF_SOAP_FAULT = "jaxws.response.throwExceptionIfSOAPFault"; + + /** + * Context Property: + * Name: jaxws.header.parameter.isNull.write.element.with.xsi.nil + * Value: Boolean.TRUE or Boolean.FALSE + * Default: null, which is interpretted as Boolean.TRUE + * + * If the @WebParam indicates that the parameter is mapped to a header + * and the argument for the parameter is null, this property is queried by the + * JAX-WS runtime to determine if + * a) TRUE: A SOAP header element is serialized with an xsi:nil="true" attribute + * b) FALSE: No SOAP header element is serialized. + * + * The default is TRUE because the JAX-WS developers feel that this is a safer + * approach. + * + */ + public static final String WRITE_HEADER_ELEMENT_IF_NULL = "jaxws.header.parameter.isNull.write.element.with.xsi.nil"; } Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/JAXWSProxyHandler.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/JAXWSProxyHandler.java?rev=928871&r1=928870&r2=928871&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/JAXWSProxyHandler.java (original) +++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/JAXWSProxyHandler.java Mon Mar 29 19:08:34 2010 @@ -394,7 +394,7 @@ public class JAXWSProxyHandler extends B endpointDesc.getEndpointInterfaceDescription().getOperation(method); Message message = MethodMarshallerFactory.getMarshaller(operationDesc, true, null) - .marshalRequest(args, operationDesc); + .marshalRequest(args, operationDesc, this.getRequestContext()); if (log.isDebugEnabled()) { log.debug("Request Message created successfully."); Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/MethodMarshaller.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/MethodMarshaller.java?rev=928871&r1=928870&r2=928871&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/MethodMarshaller.java (original) +++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/MethodMarshaller.java Mon Mar 29 19:08:34 2010 @@ -19,6 +19,8 @@ package org.apache.axis2.jaxws.marshaller; +import java.util.Map; + import org.apache.axis2.jaxws.description.OperationDescription; import org.apache.axis2.jaxws.message.Message; import org.apache.axis2.jaxws.message.Protocol; @@ -59,9 +61,13 @@ public interface MethodMarshaller { * This method converts SIGNATURE_ARGS into a Message. It is used on the client * * @param signatureArgs + * @param opDesc + * @param requestContext * @return Message */ - public Message marshalRequest(Object[] signatureArgs, OperationDescription opDesc) + public Message marshalRequest(Object[] signatureArgs, + OperationDescription opDesc, + Map<String, Object> requestContext) throws WebServiceException; /** Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitBareMethodMarshaller.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitBareMethodMarshaller.java?rev=928871&r1=928870&r2=928871&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitBareMethodMarshaller.java (original) +++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitBareMethodMarshaller.java Mon Mar 29 19:08:34 2010 @@ -43,6 +43,7 @@ import javax.xml.ws.WebServiceException; import java.lang.reflect.Array; import java.util.ArrayList; import java.util.List; +import java.util.Map; import java.util.TreeSet; public class DocLitBareMethodMarshaller implements MethodMarshaller { @@ -300,7 +301,7 @@ public class DocLitBareMethodMarshaller false); // Put values onto the message - MethodMarshallerUtils.toMessage(pvList, m, packages); + MethodMarshallerUtils.toMessage(pvList, m, packages, null); // Enable SWA for nested SwaRef attachments if (operationDesc.hasResponseSwaRefAttachments()) { @@ -313,7 +314,9 @@ public class DocLitBareMethodMarshaller } } - public Message marshalRequest(Object[] signatureArguments, OperationDescription operationDesc) + public Message marshalRequest(Object[] signatureArguments, + OperationDescription operationDesc, + Map<String, Object> requestContext) throws WebServiceException { EndpointInterfaceDescription ed = operationDesc.getEndpointInterfaceDescription(); @@ -355,7 +358,7 @@ public class DocLitBareMethodMarshaller false, false); // Put values onto the message - MethodMarshallerUtils.toMessage(pvList, m, packages); + MethodMarshallerUtils.toMessage(pvList, m, packages, requestContext); // Enable SWA for nested SwaRef attachments if (operationDesc.hasRequestSwaRefAttachments()) { Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitBareMinimalMethodMarshaller.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitBareMinimalMethodMarshaller.java?rev=928871&r1=928870&r2=928871&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitBareMinimalMethodMarshaller.java (original) +++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitBareMinimalMethodMarshaller.java Mon Mar 29 19:08:34 2010 @@ -40,6 +40,7 @@ import org.apache.commons.logging.LogFac import javax.xml.namespace.QName; import javax.xml.ws.WebServiceException; import java.util.List; +import java.util.Map; import java.util.TreeSet; @@ -315,7 +316,7 @@ public class DocLitBareMinimalMethodMars } // Put values onto the message - MethodMarshallerUtils.toMessage(pdeList, m, packages); + MethodMarshallerUtils.toMessage(pdeList, m, packages, null); // Enable SWA for nested SwaRef attachments if (operationDesc.hasResponseSwaRefAttachments()) { @@ -328,8 +329,10 @@ public class DocLitBareMinimalMethodMars } } - public Message marshalRequest(Object[] signatureArguments, OperationDescription operationDesc) - throws WebServiceException { + public Message marshalRequest(Object[] signatureArguments, + OperationDescription operationDesc, + Map<String, Object> requestContext) + throws WebServiceException { EndpointInterfaceDescription ed = operationDesc.getEndpointInterfaceDescription(); EndpointDescription endpointDesc = ed.getEndpointDescription(); @@ -380,7 +383,7 @@ public class DocLitBareMinimalMethodMars } // Put values onto the message...marshalling by type - MethodMarshallerUtils.toMessage(pdeList, m, packages); + MethodMarshallerUtils.toMessage(pdeList, m, packages, requestContext); // Enable SWA for nested SwaRef attachments if (operationDesc.hasRequestSwaRefAttachments()) { Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedMethodMarshaller.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedMethodMarshaller.java?rev=928871&r1=928870&r2=928871&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedMethodMarshaller.java (original) +++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedMethodMarshaller.java Mon Mar 29 19:08:34 2010 @@ -409,8 +409,10 @@ public class DocLitWrappedMethodMarshall } } - public Message marshalRequest(Object[] signatureArguments, OperationDescription operationDesc) - throws WebServiceException { + public Message marshalRequest(Object[] signatureArguments, + OperationDescription operationDesc, + Map<String, Object> requestContext) + throws WebServiceException { EndpointInterfaceDescription ed = operationDesc.getEndpointInterfaceDescription(); EndpointDescription endpointDesc = ed.getEndpointDescription(); Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedMinimalMethodMarshaller.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedMinimalMethodMarshaller.java?rev=928871&r1=928870&r2=928871&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedMinimalMethodMarshaller.java (original) +++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedMinimalMethodMarshaller.java Mon Mar 29 19:08:34 2010 @@ -57,6 +57,7 @@ import java.lang.reflect.ParameterizedTy import java.lang.reflect.Type; import java.util.ArrayList; import java.util.List; +import java.util.Map; import java.util.TreeSet; /** @@ -80,8 +81,10 @@ public class DocLitWrappedMinimalMethodM super(); } - public Message marshalRequest(Object[] signatureArguments, OperationDescription operationDesc) - throws WebServiceException { + public Message marshalRequest(Object[] signatureArguments, + OperationDescription operationDesc, + Map<String, Object> requestContext) + throws WebServiceException { if (log.isDebugEnabled()) { log.debug("enter marshalRequest operationDesc = " + operationDesc.getName()); @@ -155,7 +158,7 @@ public class DocLitWrappedMinimalMethodM } // Put values onto the message - MethodMarshallerUtils.toMessage(pdeList, m, packages); + MethodMarshallerUtils.toMessage(pdeList, m, packages, requestContext); // Enable SWA for nested SwaRef attachments if (operationDesc.hasRequestSwaRefAttachments()) { @@ -400,7 +403,7 @@ public class DocLitWrappedMinimalMethodM // TODO Should we check for null output body values? Should we check for null output header values ? // Put values onto the message - MethodMarshallerUtils.toMessage(pdeList, m, packages); + MethodMarshallerUtils.toMessage(pdeList, m, packages, null); // Enable SWA for nested SwaRef attachments if (operationDesc.hasResponseSwaRefAttachments()) { Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedPlusMethodMarshaller.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedPlusMethodMarshaller.java?rev=928871&r1=928870&r2=928871&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedPlusMethodMarshaller.java (original) +++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedPlusMethodMarshaller.java Mon Mar 29 19:08:34 2010 @@ -569,7 +569,7 @@ public class DocLitWrappedPlusMethodMars pde.setByJavaTypeClass(actualType); } } - MethodMarshallerUtils.toMessage(headerPDEList, m, packages); + MethodMarshallerUtils.toMessage(headerPDEList, m, packages, null); } // Enable SWA for nested SwaRef attachments @@ -583,8 +583,10 @@ public class DocLitWrappedPlusMethodMars } } - public Message marshalRequest(Object[] signatureArguments, OperationDescription operationDesc) - throws WebServiceException { + public Message marshalRequest(Object[] signatureArguments, + OperationDescription operationDesc, + Map<String, Object> requestContext) + throws WebServiceException { if (log.isDebugEnabled()) { log.debug("Calling DocLitWrapperPlusMethodMarshaller.marshalRequest"); log.debug( @@ -702,7 +704,7 @@ public class DocLitWrappedPlusMethodMars } } - MethodMarshallerUtils.toMessage(headerPDEList, m, packages); + MethodMarshallerUtils.toMessage(headerPDEList, m, packages, requestContext); } // Enable SWA for nested SwaRef attachments Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/MethodMarshallerUtils.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/MethodMarshallerUtils.java?rev=928871&r1=928870&r2=928871&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/MethodMarshallerUtils.java (original) +++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/MethodMarshallerUtils.java Mon Mar 29 19:08:34 2010 @@ -24,6 +24,7 @@ import org.apache.axis2.description.Axis import org.apache.axis2.description.AxisService; import org.apache.axis2.description.Parameter; import org.apache.axis2.java.security.AccessController; +import org.apache.axis2.jaxws.Constants; import org.apache.axis2.jaxws.ExceptionFactory; import org.apache.axis2.jaxws.core.MessageContext; import org.apache.axis2.jaxws.description.AttachmentDescription; @@ -34,6 +35,7 @@ import org.apache.axis2.jaxws.descriptio import org.apache.axis2.jaxws.description.ParameterDescription; import org.apache.axis2.jaxws.description.ServiceDescription; import org.apache.axis2.jaxws.i18n.Messages; +import org.apache.axis2.jaxws.marshaller.impl.alt.Element; import org.apache.axis2.jaxws.message.Block; import org.apache.axis2.jaxws.message.Message; import org.apache.axis2.jaxws.message.Protocol; @@ -82,6 +84,7 @@ import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; import java.util.List; +import java.util.Map; import java.util.TreeSet; /** Static Utilty Classes used by the MethodMarshaller implementations in the alt package. */ @@ -92,6 +95,7 @@ public class MethodMarshallerUtils { private static JAXBBlockFactory factory = (JAXBBlockFactory)FactoryRegistry.getFactory(JAXBBlockFactory.class); + /** Intentionally Private. This is a static utility class */ private MethodMarshallerUtils() { } @@ -334,8 +338,18 @@ public class MethodMarshallerUtils { index++; } - Element element = new Element(block.getBusinessObject(consume), - block.getQName()); + Element element; + if (block != null) { + element = new Element(block.getBusinessObject(true), + block.getQName()); + } else { + // The block could be null if the header is missing (which is allowed) + QName qName = new QName(pd.getTargetNamespace(),pd.getParameterName()); + if (log.isDebugEnabled()) { + log.debug("There is no value in the incoming message for " + qName); + } + element = new Element(null, qName, pd.getParameterActualType()); + } PDElement pde = new PDElement(pd, element, unmarshalByJavaType == null ? null : unmarshalByJavaType[i]); @@ -503,17 +517,20 @@ public class MethodMarshallerUtils { } } + /** * Marshal the element enabled objects (pvList) to the Message * * @param pdeList element enabled objects * @param message Message * @param packages Packages needed to do a JAXB Marshal + * @param contextProperties RequestContext or ResponseContext or null * @throws MessageException */ static void toMessage(List<PDElement> pdeList, Message message, - TreeSet<String> packages) throws WebServiceException { + TreeSet<String> packages, + Map<String, Object> contextProperties) throws WebServiceException { int totalBodyBlocks = 0; for (int i = 0; i < pdeList.size(); i++) { @@ -545,7 +562,7 @@ public class MethodMarshallerUtils { } // Create a JAXBBlock out of the value. // (Note that the PDElement.getValue always returns an object - // that has an element rendering...ie. it is either a JAXBElement o + // that has an element rendering...ie. it is either a JAXBElement or // has @XmlRootElement defined Block block = factory.createFrom(pde.getElement().getElementValue(), @@ -554,8 +571,18 @@ public class MethodMarshallerUtils { if (pde.getParam().isHeader()) { // Header block - QName qname = block.getQName(); - message.setHeaderBlock(qname.getNamespaceURI(), qname.getLocalPart(), block); + if (pde.getElement().getTypeValue() != null) { + // The value is non-null, add a header. + QName qname = block.getQName(); + message.setHeaderBlock(qname.getNamespaceURI(), qname.getLocalPart(), block); + } else { + // The value is null, it is still best to add a nil header. + // But query to see if an override is desired. + if (isWriteWithNilHeader(contextProperties)) { + QName qname = block.getQName(); + message.setHeaderBlock(qname.getNamespaceURI(), qname.getLocalPart(), block); + } + } } else { // Body block if (totalBodyBlocks < 1) { @@ -584,6 +611,32 @@ public class MethodMarshallerUtils { } /** + * @return Determine if a null header parameter should be written with a header + * element containing nill (true) or whether the header element should + * not be written at all (false) + */ + private static boolean isWriteWithNilHeader(Map<String, Object> map) { + if (map == null) { + if (log.isDebugEnabled()) { + log.debug("Context Properties are not available. Return true "); + } + return true; + } + Object value = map.get(Constants.WRITE_HEADER_ELEMENT_IF_NULL); + if (value == null) { + if (log.isDebugEnabled()) { + log.debug("Write header element with xsi:nil because the following property is not set " + + Constants.WRITE_HEADER_ELEMENT_IF_NULL); + } + return true; + } else { + if (log.isDebugEnabled()) { + log.debug("Key=" + Constants.WRITE_HEADER_ELEMENT_IF_NULL + " Value=" + value); + } + return ((Boolean) value).booleanValue(); + } + } + /** * Marshals the return object to the message (used on server to marshal return object) * * @param returnElement element Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/RPCLitMethodMarshaller.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/RPCLitMethodMarshaller.java?rev=928871&r1=928870&r2=928871&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/RPCLitMethodMarshaller.java (original) +++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/RPCLitMethodMarshaller.java Mon Mar 29 19:08:34 2010 @@ -41,6 +41,7 @@ import javax.jws.soap.SOAPBinding.Style; import javax.xml.namespace.QName; import javax.xml.ws.WebServiceException; import java.util.List; +import java.util.Map; import java.util.TreeSet; public class RPCLitMethodMarshaller implements MethodMarshaller { @@ -51,8 +52,10 @@ public class RPCLitMethodMarshaller impl super(); } - public Message marshalRequest(Object[] signatureArguments, OperationDescription operationDesc) - throws WebServiceException { + public Message marshalRequest(Object[] signatureArguments, + OperationDescription operationDesc, + Map<String, Object> requestContext) + throws WebServiceException { EndpointInterfaceDescription ed = operationDesc.getEndpointInterfaceDescription(); EndpointDescription endpointDesc = ed.getEndpointDescription(); @@ -139,7 +142,7 @@ public class RPCLitMethodMarshaller impl } // Put values onto the message - MethodMarshallerUtils.toMessage(pdeList, m, packages); + MethodMarshallerUtils.toMessage(pdeList, m, packages, requestContext); // Enable SWA for nested SwaRef attachments if (operationDesc.hasRequestSwaRefAttachments()) { @@ -373,7 +376,7 @@ public class RPCLitMethodMarshaller impl } // TODO Should we check for null output body values? Should we check for null output header values ? // Put values onto the message - MethodMarshallerUtils.toMessage(pdeList, m, packages); + MethodMarshallerUtils.toMessage(pdeList, m, packages, null); // Enable SWA for nested SwaRef attachments if (operationDesc.hasResponseSwaRefAttachments()) {