aspose file tools*
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


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "http post with bpel" Watch "http post with bpel" New topic
Author

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="http://xml.netbeans.org/schema/XmlPost">
<ns0:LastName xmlns:ns0="http://xml.netbeans.org/schema/XmlPost" />
<ns0:FirstName xmlns:ns0="http://xml.netbeans.org/schema/XmlPost" />
<ns0:EmailAddress xmlns:ns0="http://xml.netbeans.org/schema/XmlPost">
LastName=aa&FirstName=bb&EmailAddress=cc&OfficeAddress=dd</ns0:EmailAddress>
<ns0 fficeAddress xmlns:ns0="http://xml.netbeans.org/schema/XmlPost" />
</myContact>

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.

Thanks,

================================================================================================
Here's my html page to call the bpel process:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<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" />
</form>

</body>
</html>

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

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://xml.netbeans.org/schema/XmlPost"
xmlns:tns="http://xml.netbeans.org/schema/XmlPost"
elementFormDefault="qualified">
<xsd:complexType name="MyContact">
<xsd:sequence>
<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:sequence>
</xsd:complexType>
<xsd:element name="myContact" nillable="true" type="tns:MyContact"/>
</xsd:schema>

=================================================================================================
Here is my bpel file:
<?xml version="1.0" encoding="UTF-8"?>
<process
name="XmlPost"
targetNamespace="http://enterprise.netbeans.org/bpel/XmlPost/XmlPost"
xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://enterprise.netbeans.org/bpel/XmlPost/XmlPost" xmlns:ns1="http://j2ee.netbeans.org/wsdl/XmlPostService" xmlns:ns0="http://xml.netbeans.org/schema/XmlPost" xmlns:ns2="http://enterprise.netbeans.org/bpel/LogServiceServiceWrapper" xmlns:ns3="http://service.log.com/">
<import namespace="http://j2ee.netbeans.org/wsdl/XmlPostService" location="XmlPostService.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"/>
<partnerLinks>
<partnerLink name="PartnerLink1" partnerLinkType="ns1:XmlPostService1" myRole="XmlPostServicePortTypeRole"/>
</partnerLinks>
<variables>
<variable name="XmlPostServiceOperationOut" messageType="ns1:XmlPostServiceOperationReply"/>
<variable name="XmlPostServiceOperationIn" messageType="ns1:XmlPostServiceOperationRequest"/>
</variables>
<sequence>
<receive name="Receive1" createInstance="yes" partnerLink="PartnerLink1" operation="XmlPostServiceOperation" portType="ns1:XmlPostServicePortType" variable="XmlPostServiceOperationIn"/>
<assign name="Assign1">
<copy>
<from variable="XmlPostServiceOperationIn" part="LastName"/>
<to>$XmlPostServiceOperationOut.outcome/ns0:LastName</to>
</copy>
<copy>
<from variable="XmlPostServiceOperationIn" part="FirstName"/>
<to>$XmlPostServiceOperationOut.outcome/ns0:FirstName</to>
</copy>
<copy>
<from variable="XmlPostServiceOperationIn" part="EmailAddress"/>
<to>$XmlPostServiceOperationOut.outcome/ns0:EmailAddress</to>
</copy>
<copy>
<from variable="XmlPostServiceOperationIn" part="OfficeAddress"/>
<to>$XmlPostServiceOperationOut.outcome/ns0 fficeAddress</to>
</copy>
</assign>
<reply name="Reply1" partnerLink="PartnerLink1" operation="XmlPostServiceOperation" portType="ns1:XmlPostServicePortType" variable="XmlPostServiceOperationOut"/>
</sequence>
</process>

======================================================================================================
Here's my wsdl file:
<?xml version="1.0" encoding="UTF-8"?>
<definitions name="XmlPostService" targetNamespace="http://j2ee.netbeans.org/wsdl/XmlPostService"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:ns="http://xml.netbeans.org/schema/XmlPost"
xmlns lnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:tns="http://j2ee.netbeans.org/wsdl/XmlPostService">
<types>
<xsd:schema targetNamespace="http://j2ee.netbeans.org/wsdl/XmlPostService">
<xsd:import namespace="http://xml.netbeans.org/schema/XmlPost" schemaLocation="XmlPost.xsd"/>
</xsd:schema>
</types>
<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>
<message name="XmlPostServiceOperationReply">
<part name="outcome" element="ns:myContact"/>
</message>
<portType name="XmlPostServicePortType">
<operation name="XmlPostServiceOperation">
<input name="input1" message="tns:XmlPostServiceOperationRequest"/>
<output name="output1" message="tns:XmlPostServiceOperationReply"/>
</operation>
</portType>
<binding name="XmlPostServiceBinding" type="tns:XmlPostServicePortType">
<http:binding verb="POST"/>
<operation name="XmlPostServiceOperation">
<http peration location="submit"/>
<input name="input1">
<http:urlEncoded/>
</input>
<output name="output1">
<mime:mimeXml part="outcome"/>
</output>
</operation>
</binding>
<service name="XmlPostServiceService">
<port name="XmlPostServicePort" binding="tns:XmlPostServiceBinding">
<http:address location="http://localhost:18182/XmlPostServiceService/XmlPostServicePort"/>
</port>
</service>
<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>
</definitions>

================================================================================================
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2922
    
    5
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
Bartender

Joined: Aug 19, 2005
Posts: 2922
    
    5
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: http://aspose.com/file-tools
 
subject: http post with bpel