3 Replies Latest reply on Sep 20, 2007 10:16 PM by kittuokkade

    problem with input the xmlstring from flex to a webservice

    kittuokkade Level 1
      hi ,

      i want to send xml string as input to a webservice .i had a problem with this. iam pasting the code iam using.

      public var sResult:String="<?xml version='1.0' encoding='UTF-8' ?>
      <root><sample><id>8098</id><type>CD</type><unit>nm</unit></sample></root>";
      <mx:WebService id="myws"
      wsdl=" http://localhost:8080/myws/method?wsdl"
      useProxy="false">
      <mx:operation name="getCD" result="resultHandler(event)" fault="Alert.show(event.fault.message)">
      <mx:request>
      <String_1> {sResult} </String_1>
      </mx:request>
      </mx:operation>
      </mx:WebService>
      <mx:Panel width="652" height="408">
      <mx:Button x="368" y="2" label="Lot_id" id="mybutton" click="myws.getCD.send()"/>
      </mx:Panel>

      when i use any string for sResult .it is working fine.but when i use xml string it is giving the error SOAP request error.
      i need ur help.

        • 1. Re: problem with input the xmlstring from flex to a webservice
          RBlank_AlmerBlank
          Try this...

          private var myXML:XML = <root><sample><id>'8098'</id><type>'CD'</type><unit>'nm'</unit></sample></root>;
          public var sResult:String = myXML.toXMLString();
          • 2. Re: problem with input the xmlstring from flex to a webservice
            kittuokkade Level 1
            yah ,i tried the same string.iam getting the same error .this is the error .

            ERROR [SOAPFaultExceptionHelper] SOAP request exception
            javax.xml.rpc.JAXRPCException: org.jboss.ws.binding.BindingException: org.jboss.ws.jaxb.UnmarshalException: Failed to parse source: { http://www.w3.org/2001/XMLSchema}string type of element { http://webservice.autoee/jaws}String_1 should be complex and contain root as a child element.
            at org.jboss.ws.soap.SOAPContentElement.getObjectValue(SOAPContentElement.java:303)
            at org.jboss.ws.binding.EndpointInvocation.transformPayloadValue(EndpointInvocation.java:233 )
            at org.jboss.ws.binding.EndpointInvocation.getRequestParamValue(EndpointInvocation.java:103)
            at org.jboss.ws.binding.EndpointInvocation.getRequestPayload(EndpointInvocation.java:117)
            at org.jboss.ws.server.ServiceEndpointInvokerJSE.invokeServiceEndpoint(ServiceEndpointInvoke rJSE.java:94)
            at org.jboss.ws.server.ServiceEndpointInvoker.invoke(ServiceEndpointInvoker.java:115)
            at org.jboss.ws.server.ServiceEndpoint.handleRequest(ServiceEndpoint.java:209)
            at org.jboss.ws.server.ServiceEndpointManager.processSOAPRequest(ServiceEndpointManager.java :355)
            at org.jboss.ws.server.StandardEndpointServlet.doPost(StandardEndpointServlet.java:115)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
            at org.jboss.ws.server.StandardEndpointServlet.service(StandardEndpointServlet.java:76)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.j ava:252)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
            at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.j ava:202)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
            at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
            at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
            at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.ja va:175)
            at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
            at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
            at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
            at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
            at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
            at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
            at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
            at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Htt p11BaseProtocol.java:664)
            at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
            at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
            at java.lang.Thread.run(Unknown Source)
            Caused by: org.jboss.ws.binding.BindingException: org.jboss.ws.jaxb.UnmarshalException: Failed to parse source: { http://www.w3.org/2001/XMLSchema}string type of element { http://webservice.autoee/jaws}String_1 should be complex and contain root as a child element.
            at org.jboss.ws.jaxrpc.encoding.JAXBDeserializer.deserialize(JAXBDeserializer.java:100)
            at org.jboss.ws.soap.SOAPContentElement.getObjectValue(SOAPContentElement.java:235)
            ... 30 more
            Caused by: org.jboss.ws.jaxb.UnmarshalException: Failed to parse source: { http://www.w3.org/2001/XMLSchema}string type of element { http://webservice.autoee/jaws}String_1 should be complex and contain root as a child element.
            at org.jboss.ws.jaxb.JBossXBUnmarshallerImpl.unmarshal(JBossXBUnmarshallerImpl.java:67)
            at org.jboss.ws.jaxrpc.encoding.JAXBDeserializer.deserialize(JAXBDeserializer.java:92)
            ... 31 more
            Caused by: org.jboss.xb.binding.JBossXBException: Failed to parse source: { http://www.w3.org/2001/XMLSchema}string type of element { http://webservice.autoee/jaws}String_1 should be complex and contain root as a child element.
            at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:156)
            at org.jboss.xb.binding.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:126)
            at org.jboss.ws.jaxb.JBossXBUnmarshallerImpl.unmarshal(JBossXBUnmarshallerImpl.java:63)
            ... 32 more
            Caused by: org.jboss.xb.binding.JBossXBRuntimeException: { http://www.w3.org/2001/XMLSchema}string type of element { http://webservice.autoee/jaws}String_1 should be complex and contain root as a child element.
            at org.jboss.xb.binding.sunday.unmarshalling.SundayContentHandler.startElement(SundayContent Handler.java:187)
            at org.jboss.xb.binding.parser.sax.SaxJBossXBParser$DelegatingContentHandler.startElement(Sa xJBossXBParser.java:301)
            at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
            at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
            at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch( Unknown Source)
            at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
            at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
            at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
            at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
            at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
            at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
            at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:152)
            ... 34 more
            • 3. Re: problem with input the xmlstring from flex to a webservice
              kittuokkade Level 1
              thanx for reply,but it is giving the same error Soap request error .unable to parse the source .if i give the input like this it is working fine
              var sResult:String=&lt;root&gt;&lt;sample&gt;&lt;id&gt;..............................soon.

              if i replace < with &lt; and > with &gt:
              it is working fine.but i cannot send the string like that .so whats happening .i need help in this.