[Users] Arbitrary/plain text through HTTP

nch underscore_dot at yahoo.com
Wed Mar 16 10:59:47 CET 2011


So far I was able to implement a simple REST service, but looks as if it could only transport XML.
I created a BPEL process through Petals Studio (and hit "Create concrete projects") and made only two modifications:
- The service WSDL: message parts to be xsd:anyType
- The SOAP SU's jbi.xml to make it work in REST mode.

Using cURL I did some manual testing:


Code:

C:\>curl -i -H "content-type:application/xml" -H "accept:application/xml" -X GET http://127.0.0.1:8084/petals/services/echoRestProcessService/process?hello=world
HTTP/1.1 200 OK
Content-Type: application/xml; charset=UTF-8
Transfer-Encoding: chunked
Server: Jetty(6.1.9)

<hello>world</hello>

C:\>curl -i -H "content-type:application/xml" -H "accept:application/xml" -X GET http://127.0.0.1:8084/petals/services/echoRestProcessService/process?hello=world&hello2=world2
HTTP/1.1 200 OK
Content-Type: application/xml; charset=UTF-8
Transfer-Encoding: chunked
Server: Jetty(6.1.9)

<hello>world</hello>"hello2" is not recognized as an internal or external command, operable program  or batch file.

C:\>curl -i -H "content-type:application/xml" -H "accept:application/xml" -d "<hello>world</hello>" -X POST http://127.0.0.1:8084/petals/services/echoRestProcessService/process
HTTP/1.1 200 OK
Content-Type: application/xml; charset=UTF-8
Transfer-Encoding: chunked
Server: Jetty(6.1.9)

<echoRestProcessResponseMessage>world</echoRestProcessResponseMessage>

C:\>curl -i -H "content-type:text/plain" -H "accept:text/plain" -d "hello world" -X POST http://127.0.0.1:8084/petals/services/echoRestProcessService/process
HTTP/1.1 500 Internal Server Error
Content-Type: application/soap+xml; charset=UTF-8; action="http://www.w3.org/2005/08/addressing/soap/fault"
Transfer-Encoding: chunked
Server: Jetty(6.1.9)

<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv
:Header xmlns:wsa="http://www.w3.org/2005/08/addressing"><wsa:Action>http://www.w3.org/2005/08/addressing/soap/fault</ws
a:Action></soapenv:Header><soapenv:Body><soapenv:Fault><soapenv:Code><soapenv:Value>soapenv:Receiver</soapenv:Value></so
apenv:Code><soapenv:Reason><soapenv:Text xml:lang="en-US">com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected chara
cter 'h' (code 104) in prolog; expected '&lt;'

 at [row,col {unknown-source}]: [1,1]</soapenv:Text></soapenv:Reason><soapenv:Detail /></soapenv:Fault></soapenv:Body></
soapenv:Envelope>

C:\>curl -i -H "content-type:text/plain" -H "accept:text/plain" -d "<hello>world</hello>" -X POST http://127.0.0.1:8084/petals/services/echoRestProcessService/process
HTTP/1.1 500 Internal Server Error
Content-Type: application/soap+xml; charset=UTF-8; action="http://www.w3.org/2005/08/addressing/soap/fault"
Transfer-Encoding: chunked
Server: Jetty(6.1.9)

<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv
:Header xmlns:wsa="http://www.w3.org/2005/08/addressing"><wsa:Action>http://www.w3.org/2005/08/addressing/soap/fault</ws
a:Action></soapenv:Header><soapenv:Body><soapenv:Fault><soapenv:Code><soapenv:Value>soapenv:Receiver</soapenv:Value></so
apenv:Code><soapenv:Reason><soapenv:Text xml:lang="en-US">First Element must contain the local name, Envelope , but foun
d hello</soapenv:Text></soapenv:Reason><soapenv:Detail /></soapenv:Fault></soapenv:Body></soapenv:Envelope>





Apart from content type issues, I'm also concerned about securing REST services. Would Rampant configuration still be suitable? Should I configure HTTP authentication? Then, how can I integrate it?

Many thanks for your suggestions.




-------------------- m2f --------------------

Subscribe/Unsubscribe emails notifications.

Response to this email will be posted on the Petals forum.
Please delete the existing text before responding :)

Read the topic online:
http://forum.petalslink.com/viewtopic.php?p=31093#31093

-------------------- m2f --------------------






More information about the Users mailing list