Hi Mohan, (I'm copying the axis-user since I noticed you also posted this question there, too.)
The problem seems to be with your code. Keep these in mind: 1) arg0 is a string type. 2) Since you are placing an XML-formatted string in arg0, the string must be XML-escaped. Don't put raw XML in arg0. 3) The xmlObject.set(obj) method is meant only to take in the same type of object (or a subclass of that object) that you are calling the set() on. It just copies over the value of the input object. So you can do objectA.set(otherObjectA), but should not do objectA.set(objectB). 4) Don't do: test.setArg0(request.toString()); // This is probably why you're getting CDATA. And don't do: test.set(request); // request and test are not the same types Instead, you need to do: String escapedVal = ... // Convert request to an XML string, and then XML-escape it. test.setArg0(escapedVal); On the server side, your code will need to first take arg0 and "unescape" the value before it can work with it as proper XML. It should not assume to get raw XML in arg0. -Vinh -----Original Message----- From: Mohan Radhakrishnan [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 03, 2008 3:09 AM To: user@xmlbeans.apache.org Subject: Document literal style - Send XML as string Hi, There is lot of code in this mail. Hope I am asking the right question. I am using the doc/lit style to send a xs:string type. Now if I post an entire XML then it gets wrapped in CDATA. I am using Axis 2 XMLBeans bindings. The WSDL is pasted at the end. The SOAP message is <?xml version=...............?> <soapenv:Envelope xmlns:soapenv="http: //schemas.xmlsoap.org/soap/envelope/"> <soapenv:Body><something:test xmlns: something="http://test.com"> <something:arg0><![CDATA[<Request xsi: noNamespaceSchemaLocation="Test1.0.4.xsd" xmlns:xsi="http://www.w3. org/2001/XMLSchemainstance"> <Header> .......... ......... </soapenv:Envelope> when I use this code. stub = new TestServiceStub( SECURE_WEB_SERVICE ); document = TestDocument.Factory.newInstance(); File file = new File("Request.xml" ); Request request = Request. Factory. parse( getXml( file ) ); //Set XML as string test = document.addNewTest(); test.setArg0( request.toString() ); document.setTest( test ); In the code shown above if I replaced setArg0( request.toString() ); with set( getXmlObject() ); //XMLBeans API I get my XML as a child like this. <?xml version='1.0' encoding='UTF-8'?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Body> <someprefix:test xmlns:rul="http://test.com"> <Request xsi:noNamespaceSchemaLocation="Test.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchemainstance"> .................... </soapenv:Envelope> but the error is "Unexpected subelement". 1. Which of these two styles is correct according to the WSDL. 2. How is "someprefix" getting generated. It does not match anything in my WSDL. (E.G) <someprefix:test xmlns:rul="http://test.com"> Thanks, Mohan <?xml version='1.0' encoding='UTF-8'?> <s0:definitions name="TestServiceDefinitions" targetNamespace="http://test.com" xmlns="" xmlns:s0="http://schemas.xmlsoap.org/wsdl/" xmlns:s1="http://test.com" xmlns:s2="http://schemas.xmlsoap.org/wsdl/soap/" > <s0:types> <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://test.com" xmlns:s0="http://schemas.xmlsoap.org/wsdl/" xmlns:s1="http://test.com" xmlns:s2="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="test"> <xs:complexType> <xs:sequence> <xs:element name="arg0" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="testResponse"> <xs:complexType> <xs:sequence> <xs:element name="return" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> </s0:types> <s0:message name="test"> <s0:part element="s1:test" name="parameters"/> </s0:message> <s0:message name="testResponse"> <s0:part element="s1:testResponse" name="parameters"/> </s0:message> <s0:portType name="TestPortType"> <s0:operation name="test" parameterOrder="parameters"> <s0:input message="s1:test"/> <s0:output message="s1:testResponse"/> </s0:operation> </s0:portType> <s0:binding name="TestServiceSoapBinding" type="s1:TestPortType"> <s2:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> <s0:operation name="test"> <s2:operation soapAction="http://test.com/test" style="document"/> <s0:input> <s2:body parts="parameters" use="literal"/> </s0:input> <s0:output> <s2:body parts="parameters" use="literal"/> </s0:output> </s0:operation> </s0:binding> <s0:service name="TestService"> <s0:port binding="s1:TestServiceSoapBinding" name="TestPort"> <s2:address location="http://localhost:8081/axis2/services/TestService"/> </s0:port> </s0:service> </s0:definitions> -- View this message in context: http://www.nabble.com/Document-literal-style---Send-XML-as-string-tp1762 0196p17620196.html Sent from the Xml Beans - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]