Thanks Hiranya.
It work.

Saludos,
Ing. Jorge Infante Osorio.
J´Dpto Soluciones SOA.
CDAE.
Fac. 5.
UCI.

De: Hiranya Jayathilaka [mailto:[email protected]] 
Enviado el: miércoles, 23 de mayo de 2012 8:41
Para: Jorge Infante Osorio
CC: [email protected]; [email protected]
Asunto: Re: [Dev] [User] Problem with API in ESB

Works fine for me. Here's my TCPMon trace:

POST /foo/bar/datos/getporid/1 HTTP/1.1
Content-Type: application/xml; charset=UTF-8
Accept: */*
Transfer-Encoding: chunked
Host: 127.0.0.1:8080
Connection: Keep-Alive
User-Agent: Synapse-HttpComponents-NIO

8d
<axis2ns37:_getdatosusuario_id
xmlns:axis2ns37="http://cdae.uci.cu/servicios/";>
   <axis2ns37:id>1</axis2ns37:id></axis2ns37:_getdatosusuario_id>0

Of course I had to add the following property mediator to make the
GET-to-POST transformation:

<property name="HTTP_METHOD" value="POST" scope="axis2"/>

But didn't see any issue of the sort you have mentioned.

Thanks,
Hiranya

On Sat, May 19, 2012 at 8:55 AM, Jorge Infante Osorio <[email protected]>
wrote:
Hi all.
Any idea on this?

Saludos,
Ing. Jorge Infante Osorio.
J´Dpto Soluciones SOA.
CDAE.
Fac. 5.
UCI.

De: [email protected] [mailto:[email protected]] En nombre de Jorge
Infante Osorio
Enviado el: miércoles, 16 de mayo de 2012 2:28
Para: [email protected]
Asunto: [User] Problem with API in ESB

Hi all.
I have this API:

<api xmlns="http://ws.apache.org/ns/synapse"; name="DatosUsuarios"
context="/datos">
   <resource methods="GET" uri-template="/listadousuarios"
inSequence="RESTin" outSequence="RESTout" faultSequence="fault" />
   <resource methods="GET" uri-template="/getporid/{id}"
inSequence="RESTinid" outSequence="RESToutid" faultSequence="fault" />
</api>

I want to call it in this way: curl -v
http://127.0.0.1:8280/datos/getporid/1 but the request in the BE it´s
malformed.


The Sequence RESTinid:

<sequence xmlns="http://ws.apache.org/ns/synapse"; name="RESTinid"
trace="enable">
    <log level="full" category="DEBUG"/>
    <payloadFactory>
        <format>
            <axis2ns37:_getdatosusuario_id
xmlns:axis2ns37="http://cdae.uci.cu/servicios/";>
                <axis2ns37:id>$1</axis2ns37:id>
            </axis2ns37:_getdatosusuario_id>
        </format>
        <args>
            <arg xmlns:ns="http://org.apache.synapse/xsd";
xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope";
xmlns:ns3="http://org.apache.synapse/xsd";
expression="get-property('uri.var.id')"/>
        </args>
    </payloadFactory>
    <send>
        <endpoint>
            <address
uri="http://127.0.0.1:9765/services/DatosUsuariosREST.HTTPEndpoint/datosusua
rio" format="rest"/>
        </endpoint>
    </send>
</sequence>

With the payloadFactory mediator I have this error in the message format in
the BE restful service deploy in AS:

<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope";>
   <soapenv:Header />
   <soapenv:Body>
      <axis2ns57:_getdatosusuario_id
xmlns:axis2ns57="http://cdae.uci.cu/servicios/";>
         <axis2ns57:id>datos/getporid/1</axis2ns57:id>
         <axis2ns57:id>1</axis2ns57:id>
      </axis2ns57:_getdatosusuario_id>
   </soapenv:Body>
</soapenv:Envelope>

Without the payloadFactory I see this:

<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope";>
   <soapenv:Header />
   <soapenv:Body>
      <axis2ns56:_getdatosusuario_id
xmlns:axis2ns56="http://cdae.uci.cu/servicios/";>
         <axis2ns56:id>datos/getporid/1</axis2ns56:id>
      </axis2ns56:_getdatosusuario_id>
   </soapenv:Body>
</soapenv:Envelope>

In any case I don´t know why I get this value: datos/getporid/1

In ESB I see this error:
Message ID : urn:uuid:b82cbd23-2c74-4e6f-9aeb-6b711c8f779e] [Status
Completed : true] [Status SendingCompleted : true]
[2012-05-16 02:19:44,816]  WARN - ClientWorker Unexpected response received.
HTTP response code : 500 HTTP status : Internal Server Error exception :
com.c
tc.wstx.exc.WstxParsingException: Unexpected close tag </body>; expected
</HR>.
at [row,col {unknown-source}]: [67,187]
[2012-05-16 02:19:44,818] ERROR - NativeWorkerPool Uncaught exception
java.lang.ClassCastException: org.apache.axiom.om.impl.llom.OMTextImpl
cannot be cast to org.apache.axiom.om.OMElement
        at
org.apache.synapse.util.MessageHelper.cloneSOAPFault(MessageHelper.java:441)
        at
org.apache.synapse.util.MessageHelper.cloneSOAPEnvelope(MessageHelper.java:2
54)
        at
org.apache.synapse.core.axis2.SOAPUtils.convertSOAP11toSOAP12(SOAPUtils.java
:95)
        at
org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseC
allbackReceiver.java:323)
        at
org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbac
kReceiver.java:160)
        at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:181)
        at
org.apache.synapse.transport.nhttp.ClientWorker.run(ClientWorker.java:275)
        at
org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerP
ool.java:173)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.ja
va:886)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:9
08)
        at java.lang.Thread.run(Thread.java:662)

The out sequence:
<sequence xmlns="http://ws.apache.org/ns/synapse"; name="RESTout"
trace="enable">
    <send/>
</sequence>


I try the BE service with curl, and all it´s fine.
curl
http://127.0.0.1:9765/services/DatosUsuariosREST.HTTPEndpoint/datosusuario/1


Saludos,
Ing. Jorge Infante Osorio.
J´Dpto Soluciones SOA.
CDAE.
Fac. 5.
UCI.









10mo. ANIVERSARIO DE LA CREACION DE LA UNIVERSIDAD DE LAS CIENCIAS
INFORMATICAS...
CONECTADOS AL FUTURO, CONECTADOS A LA REVOLUCION

http://www.uci.cu
http://www.facebook.com/universidad.uci
http://www.flickr.com/photos/universidad_uci
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev




-- 
Hiranya Jayathilaka
Senior Technical Lead;
WSO2 Inc.;  http://wso2.org
E-mail: [email protected];  Mobile: +94 77 633 3491
Blog: http://techfeast-hiranya.blogspot.com


10mo. ANIVERSARIO DE LA CREACION DE LA UNIVERSIDAD DE LAS CIENCIAS 
INFORMATICAS...
CONECTADOS AL FUTURO, CONECTADOS A LA REVOLUCION

http://www.uci.cu
http://www.facebook.com/universidad.uci
http://www.flickr.com/photos/universidad_uci
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to