File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Services and the fly likes http post with bpel Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "http post with bpel" Watch "http post with bpel" New topic

http post with bpel

Bob Green
Ranch Hand

Joined: Feb 29, 2004
Posts: 93
I am not sure if this forum is the right forum for my question but I post anyway to see if anyone can help
me. I have created a very simple bpel using http post; all it does is to copy the input to the output.
The output from my bpel looks like this:
<myContact xmlns="">
<ns0:LastName xmlns:ns0="" />
<ns0:FirstName xmlns:ns0="" />
<ns0:EmailAddress xmlns:ns0="">
<ns0 fficeAddress xmlns:ns0="" />

My question is why the EmailAddress element contains all my input data. I should expect the lastname element
has 'aa', the firstname element has 'bb', the emailAddress has 'cc' and the officeAddress has 'dd'.

Can someone please tell me what I do wrong in here.


Here's my html page to call the bpel process:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<form action="http://localhost:18182/XmlPostServiceService/XmlPostServicePort/submit" method="POST">
Last Name: <input type="text" name="LastName" value="" size="10" />
First Name: <input type="text" name="FirstName" value="" size="10" />
Email Address: <input type="text" name="EmailAddress" value="" size="10" />
Office Address: <input type="text" name="OfficeAddress" value="" size="10" />
<input type="submit" value="post" />


Here is the xsd file:
<?xml version="1.0" encoding="UTF-8"?>

<xsd:schema xmlns:xsd=""
<xsd:complexType name="MyContact">
<xsd:element name="LastName" nillable="true" type="xsd:string"/>
<xsd:element name="FirstName" nillable="true" type="xsd:string"/>
<xsd:element name="EmailAddress" nillable="true" type="xsd:string"/>
<xsd:element name="OfficeAddress" nillable="true" type="xsd:string"/>
<xsd:element name="myContact" nillable="true" type="tns:MyContact"/>

Here is my bpel file:
<?xml version="1.0" encoding="UTF-8"?>
xmlns:tns="" xmlns:ns1="" xmlns:ns0="" xmlns:ns2="" xmlns:ns3="">
<import namespace="" location="XmlPostService.wsdl" importType=""/>
<partnerLink name="PartnerLink1" partnerLinkType="ns1:XmlPostService1" myRole="XmlPostServicePortTypeRole"/>
<variable name="XmlPostServiceOperationOut" messageType="ns1:XmlPostServiceOperationReply"/>
<variable name="XmlPostServiceOperationIn" messageType="ns1:XmlPostServiceOperationRequest"/>
<receive name="Receive1" createInstance="yes" partnerLink="PartnerLink1" operation="XmlPostServiceOperation" portType="ns1:XmlPostServicePortType" variable="XmlPostServiceOperationIn"/>
<assign name="Assign1">
<from variable="XmlPostServiceOperationIn" part="LastName"/>
<from variable="XmlPostServiceOperationIn" part="FirstName"/>
<from variable="XmlPostServiceOperationIn" part="EmailAddress"/>
<from variable="XmlPostServiceOperationIn" part="OfficeAddress"/>
<to>$XmlPostServiceOperationOut.outcome/ns0 fficeAddress</to>
<reply name="Reply1" partnerLink="PartnerLink1" operation="XmlPostServiceOperation" portType="ns1:XmlPostServicePortType" variable="XmlPostServiceOperationOut"/>

Here's my wsdl file:
<?xml version="1.0" encoding="UTF-8"?>
<definitions name="XmlPostService" targetNamespace=""
xmlns lnk=""
<xsd:schema targetNamespace="">
<xsd:import namespace="" schemaLocation="XmlPost.xsd"/>
<message name="XmlPostServiceOperationRequest">
<part name="LastName" type="xsd:string"/>
<part name="FirstName" type="xsd:string"/>
<part name="EmailAddress" type="xsd:string"/>
<part name="OfficeAddress" type="xsd:string"/>
<!-- part name="request" element="ns:myContact"/ -->
<message name="XmlPostServiceOperationReply">
<part name="outcome" element="ns:myContact"/>
<portType name="XmlPostServicePortType">
<operation name="XmlPostServiceOperation">
<input name="input1" message="tns:XmlPostServiceOperationRequest"/>
<output name="output1" message="tns:XmlPostServiceOperationReply"/>
<binding name="XmlPostServiceBinding" type="tns:XmlPostServicePortType">
<http:binding verb="POST"/>
<operation name="XmlPostServiceOperation">
<http peration location="submit"/>
<input name="input1">
<output name="output1">
<mime:mimeXml part="outcome"/>
<service name="XmlPostServiceService">
<port name="XmlPostServicePort" binding="tns:XmlPostServiceBinding">
<http:address location="http://localhost:18182/XmlPostServiceService/XmlPostServicePort"/>
<plnk artnerLinkType name="XmlPostService1">
<!-- A partner link type is automatically generated when a new port type is added. Partner link types are used by BPEL processes.
In a BPEL process, a partner link represents the interaction between the BPEL process and a partner service. Each partner link is associated with a partner link type.
A partner link type characterizes the conversational relationship between two services. The partner link type can have one or two roles.-->
<plnk:role name="XmlPostServicePortTypeRole" portType="tns:XmlPostServicePortType"/>
</plnk artnerLinkType>

Peer Reynders

Joined: Aug 19, 2005
Posts: 2932
In your WSDL you specify http:urlEncoded for the input of the operation.
So it is expecting to find the data as part of the query string in the URI, i.e.:

However the browser HTML form will make this type of an HTTP request:

According to the WSDL specification HTTP GET & POST Binding examples you need to specify <mime:content type="application/x-www-form-urlencoded" /> in your input binding:

Bob Green
Ranch Hand

Joined: Feb 29, 2004
Posts: 93
I tried your way and I got this error:
Error: A <http:binding> element's input requires a <http:urlEncoded> or <http:urlReplacement> element.

BTW, thank you so much for your reply.
Bob Green
Ranch Hand

Joined: Feb 29, 2004
Posts: 93
I tried your way and I got this error:
Error: A <http:binding> element's input requires a <http:urlEncoded> or <http:urlReplacement> element.
I am running on glassfish.

BTW, thank you so much for your reply.
Peer Reynders

Joined: Aug 19, 2005
Posts: 2932
Originally posted by Bob Lou:
Error: A <http:binding> element's input requires a <http:urlEncoded> or <http:urlReplacement> element.

So that would mean that your tool really only supports HTTP GET bindings. That with http:urlEncoded and "method=GET" in the form should get you running.

... though as far as I recall BPEL systems usually use SOAP bindings for new components - not HTTP bindings. Non-SOAP bindings tend to be used for connectivity with existing systems.
[ November 15, 2007: Message edited by: Peer Reynders ]
I agree. Here's the link:
subject: http post with bpel
It's not a secret anymore!