Hi All, Miyuru has point me the fault for the previous exception I got about addressing. So in the binary relay mood we have to add a address end point to send the message. So doing that I have sent the message successfully to axis2 server. But it gives some exceptions. So I look at the message sent form ESB. The message was false.
False Message : <?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv=" http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header xmlns:wsa=" http://www.w3.org/2005/08/addressing"> <wsa:To>http://localhost:9000/services/SimpleStockQuoteService</wsa:To> <wsa:MessageID>urn:uuid:f540f7a0-e450-4901-9fb8-38424e1d4c43</wsa:MessageID> <wsa:Action>urn:getQuote</wsa:Action> </soapenv:Header> <soapenv:Body> <m0:CheckPriceRequest xmlns:m0="http://services.samples"> <m0:Code>IBM</m0:Code> </m0:CheckPriceRequest>< /soapenv:Body> </soapenv:Envelope> Correct Message : <?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv=" http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header xmlns:wsa=" http://www.w3.org/2005/08/addressing"/> <soapenv:Body> <m:getQuote xmlns:m="http://services.samples"> <m:request> <m:symbol>IBM</m:symbol> </m:request> </m:getQuote> </soapenv:Body> </soapenv:Envelope> I think the problem here is the binary relay formatter drops the newly added child of the SOAP body. So what will be the solution ? Thanks AndunSLG On Fri, Sep 14, 2012 at 5:44 PM, Andun Sameera <[email protected]> wrote: > Here is the Syanpse Config I used, > > <?xml version="1.0" encoding="UTF-8"?> > <definitions xmlns="http://ws.apache.org/ns/synapse"> > <registry provider="org.wso2.carbon.mediation.registry.ESBRegistry"> > <parameter name="root">file:repository/samples/resources/</param > > eter> > <parameter name="cachableDuration">15000</parameter> > </registry> > <localEntry key="xslt-key-req" > > src="file:repository/samples/resources/transform/transform.xslt"/> > <sequence name="fault"> > <log level="full"> > <property name="MESSAGE" value="Executing default "fault" > sequence"/> > <property name="ERROR_CODE" > expression="get-property('ERROR_CODE')"/> > <property name="ERROR_MESSAGE" > expression="get-property('ERROR_MESSAGE')"/> > </log> > <drop/> > </sequence> > <sequence name="main"> > <in> > <class name="org.wso2.carbon.mediator.XMLConvertor"> > <property name="key" value="xslt-key-req"/> > </class> > </in> > <out> > <class name="org.wso2.carbon.mediator.XMLConvertor"> > <property name="key" value="transform/transform_back.xslt"/> > </class> > </out> > <send/> > </sequence> > </definitions> > > Thanks > AndunSLG > > On Fri, Sep 14, 2012 at 5:40 PM, Andun Sameera <[email protected]> wrote: > >> Hi Samisa, >> >> I have changed the Mediator code as you requested. >> >> - I have created a implementation OMDataSource interface in >> MessageOMDataSource class. >> - Then I created a OMElement using that OMDataSource. >> - After that I have attached the newly created element as a child for >> the SOAP Body of the Synpase Message Context. >> >> The changed function which writes the transformed stream for the message >> context is given bellow, >> >> private boolean writeResult(MessageContext synCtx) throws IOException, >> XMLStreamException { >> >> SOAPFactory factory = OMAbstractFactory.getSOAP12Factory(); >> SOAPEnvelope env = synCtx.getEnvelope(); >> >> if (resulMessage != null) { >> XMLStreamReader reader = >> StAXUtils.createXMLStreamReader(resulMessage.getInputStream()); >> StAXOMBuilder sb=new StAXOMBuilder(reader); >> System.out.println("Transformed Stream...................."); >> System.out.println(sb.getDocumentElement()); >> System.out.println("......................................"); >> >> OMDataSource omDataSource=new >> MessageOMDataSource(resulMessage.getOverflowBlob()); >> OMElement omEle = >> factory.createOMElement(omDataSource,sb.getDocumentElement().getQName()); >> synCtx.setDoingMTOM(false); >> env.getBody().addChild(omEle); >> >> System.out.println("Child Added Body......................"); >> System.out.println(env); >> System.out.println("......................................"); >> return true; >> } >> return false; >> } >> >> But while doing that I faced following difficulties. >> >> - When I create the OMElment using the stream I have pass the name >> space of the element to the factory. For that I have to read the Stream. >> Is >> it OK? >> - Also Message is not send to the endpoint as expected, Server >> Console Shows the following Logs, >> >> Transforming On Progress..... >> Transformed Stream.................... >> <m:getQuote xmlns:m="http://services.samples"> >> <m:request> >> <m:symbol>IBM</m:symbol> >> </m:request> >> </m:getQuote> >> ...................................... >> Child Added Body...................... >> <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv=" >> http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><ns:binary >> xmlns:ns="http://ws.apache.org/commons/ns/payload">PD94bWwgdmVyc2lvbj0nMS4wJyBlbmNvZGluZz0nVVRGLTgnPz48c29hcGVudjpFbnZlbG9wZSB4bWxuczpzb2FwZW52PSJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy9zb2FwL2VudmVsb3BlLyI+PHNvYXBlbnY6SGVhZGVyIHhtbG5zOndzYT0iaHR0cDovL3d3dy53My5vcmcvMjAwNS8wOC9hZGRyZXNzaW5nIj48d3NhOlRvPmh0dHA6Ly9sb2NhbGhvc3Q6OTAwMC9zZXJ2aWNlcy9TaW1wbGVTdG9ja1F1b3RlU2VydmljZTwvd3NhOlRvPjx3c2E6TWVzc2FnZUlEPnVybjp1dWlkOmE5YTc4M2I1LTFmNmQtNGUzNy1hZDNhLWM5YWQ3Y2M0NDY4Yjwvd3NhOk1lc3NhZ2VJRD48d3NhOkFjdGlvbj51cm46Z2V0UXVvdGU8L3dzYTpBY3Rpb24+PC9zb2FwZW52OkhlYWRlcj48c29hcGVudjpCb2R5PjxtMDpDaGVja1ByaWNlUmVxdWVzdCB4bWxuczptMD0iaHR0cDovL3NlcnZpY2VzLnNhbXBsZXMiPjxtMDpDb2RlPklCTTwvbTA6Q29kZT48L20wOkNoZWNrUHJpY2VSZXF1ZXN0Pjwvc29hcGVudjpCb2R5Pjwvc29hcGVudjpFbnZlbG9wZT4=</ns:binary><m:getQuote >> xmlns:m="http://services.samples"> >> <m:request> >> <m:symbol>IBM</m:symbol> >> </m:request> >> </m:getQuote></soapenv:Body></soapenv:Envelope> >> ...................................... >> [2012-09-14 17:05:28,798] INFO - TimeoutHandler This engine will expire >> all callbacks after : 120 seconds, irrespective of the timeout action, >> after the specified or optional timeout >> [2012-09-14 17:05:28,801] ERROR - ClientUtils The system cannot infer the >> transport information from the / URL. >> [2012-09-14 17:05:28,803] ERROR - Axis2Sender Unexpected error during >> sending message out >> org.apache.axis2.AxisFault: The system cannot infer the transport >> information from the / URL. >> at >> org.apache.axis2.description.ClientUtils.inferOutTransport(ClientUtils.java:81) >> at >> org.apache.synapse.core.axis2.DynamicAxisOperation$DynamicOperationClient.executeImpl(DynamicAxisOperation.java:123) >> at >> org.apache.axis2.client.OperationClient.execute(OperationClient.java:165) >> at >> org.apache.synapse.core.axis2.Axis2FlexibleMEPClient.send(Axis2FlexibleMEPClient.java:445) >> at org.apache.synapse.core.axis2.Axis2Sender.sendOn(Axis2Sender.java:57) >> at >> org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:281) >> at >> org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:96) >> at >> org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:60) >> at >> org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:114) >> at >> org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:188) >> at >> org.apache.synapse.core.axis2.SynapseMessageReceiver.receive(SynapseMessageReceiver.java:83) >> at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:181) >> at >> org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:172) >> at >> org.apache.synapse.transport.nhttp.ServerWorker.processEntityEnclosingMethod(ServerWorker.java:409) >> at >> org.apache.synapse.transport.nhttp.ServerWorker.run(ServerWorker.java:261) >> at >> org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172) >> at >> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) >> at >> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) >> at java.lang.Thread.run(Thread.java:662) >> [2012-09-14 17:05:28,810] INFO - LogMediator To: /, WSAction: >> urn:getQuote, SOAPAction: urn:getQuote, MessageID: >> urn:uuid:066d86ac-abb7-4cba-b5c2-2b7247c35fbd, Direction: request, MESSAGE >> = Executing default "fault" sequence, ERROR_CODE = 0, ERROR_MESSAGE = >> Unexpected error during sending message out, Envelope: <?xml version='1.0' >> encoding='utf-8'?><soapenv:Envelope xmlns:soapenv=" >> http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><ns:binary >> xmlns:ns="http://ws.apache.org/commons/ns/payload">PD94bWwgdmVyc2lvbj0nMS4wJyBlbmNvZGluZz0nVVRGLTgnPz48c29hcGVudjpFbnZlbG9wZSB4bWxuczpzb2FwZW52PSJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy9zb2FwL2VudmVsb3BlLyI+PHNvYXBlbnY6SGVhZGVyIHhtbG5zOndzYT0iaHR0cDovL3d3dy53My5vcmcvMjAwNS8wOC9hZGRyZXNzaW5nIj48d3NhOlRvPmh0dHA6Ly9sb2NhbGhvc3Q6OTAwMC9zZXJ2aWNlcy9TaW1wbGVTdG9ja1F1b3RlU2VydmljZTwvd3NhOlRvPjx3c2E6TWVzc2FnZUlEPnVybjp1dWlkOmE5YTc4M2I1LTFmNmQtNGUzNy1hZDNhLWM5YWQ3Y2M0NDY4Yjwvd3NhOk1lc3NhZ2VJRD48d3NhOkFjdGlvbj51cm46Z2V0UXVvdGU8L3dzYTpBY3Rpb24+PC9zb2FwZW52OkhlYWRlcj48c29hcGVudjpCb2R5PjxtMDpDaGVja1ByaWNlUmVxdWVzdCB4bWxuczptMD0iaHR0cDovL3NlcnZpY2VzLnNhbXBsZXMiPjxtMDpDb2RlPklCTTwvbTA6Q29kZT48L20wOkNoZWNrUHJpY2VSZXF1ZXN0Pjwvc29hcGVudjpCb2R5Pjwvc29hcGVudjpFbnZlbG9wZT4=</ns:binary><m:getQuote >> xmlns:m="http://services.samples"> >> <m:request> >> <m:symbol>IBM</m:symbol> >> </m:request> >> </m:getQuote></soapenv:Body></soapenv:Envelope> >> >> I have attached All the Java Class here. Need Instructions to proceed. >> >> Thanks >> AndunSLG >> >> On Fri, Sep 14, 2012 at 1:17 PM, Samisa Abeysinghe <[email protected]>wrote: >> >>> Did you make the out path modifications that I suggested? >>> >>> >>> On Fri, Sep 14, 2012 at 9:14 AM, Andun Sameera <[email protected]> wrote: >>> >>>> Hi All, >>>> >>>> I have re-factored the code to attache the output stream to the message >>>> as done in XSLT mediator. But some problem rises when I did that. Need help >>>> to proceed. I have attached the code here. >>>> >>>> Thanks >>>> AndunSLG >>>> >>>> >>>> On Thu, Sep 13, 2012 at 6:13 PM, Andun Sameera <[email protected]> wrote: >>>> >>>>> Hi All, >>>>> >>>>> I have developed the custom mediator to a point where it >>>>> can transform a input stream of the message using a xslt file in >>>>> a registry or the file system. I have attached the java file here with. So >>>>> next what I should do is map the out put steam given by transform to the >>>>> result as done in XSLT mediator. Am I correct ? Need to clarify. >>>>> >>>>> Thanks >>>>> AndunSLG >>>>> >>>> >>>> Thanks, >>> Samisa... >>> >>> Samisa Abeysinghe >>> VP Engineering >>> WSO2 Inc. >>> http://wso2.com >>> http://wso2.org >>> >>> >>> >> >
MessageDataSource.java
Description: Binary data
MessageOMDataSource.java
Description: Binary data
XMLConvertor.java
Description: Binary data
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
