I didn't know anything about SOAP, SOAPpy, or web services before
diving into swamp. It's ridiculously easy to do SOAP with python
thanks to SOAPpy. I've googled for plenty of hits on how to make a
python SOAP client to a Java server, but not anything the other way
around. Since it's what I need, I tried it myself.
Netbeans6 (and 5.5?) has some wonderful features for consuming web
services from WSDL files. I turned on SOAPpy debugging for the
swamp_client so I could see the SOAP messages coming and going. Using
those, I tried to reverse-engineer the swamp SOAP interface into a
WSDL file. I've only attempted the "newScriptedFlow" action, but I
got rather far. Here's what I have so far for svn revision 99 of the
swamp code. A lot of this was generated from Netbeans6 WSDL wizards.
<code>
<?xml version="1.0" encoding="UTF-8"?>
<definitions name="SwampClone" targetNamespace="http://
j2ee.netbeans.org/wsdl/SwampClone"
xmlns="
http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdl="
http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="
http://www.w3.org/2001/XMLSchema" xmlns:tns="http://
j2ee.netbeans.org/wsdl/SwampClone" xmlns:plnk="
http://docs.oasis-
open.org/wsbpel/2.0/plnktype" xmlns:soap="
http://schemas.xmlsoap.org/
wsdl/soap/">
<types/>
<message name="newScriptedFlow">
<part name="v1" type="xsd:string"/>
</message>
<message name="newScriptedFlowResponse">
<part name="Result" type="xsd:int"/>
</message>
<portType name="SwampClonePortType">
<operation name="newScriptedFlow">
<input name="input1" message="tns:newScriptedFlow"/>
<output name="output1"
message="tns:newScriptedFlowResponse"/>
</operation>
</portType>
<binding name="SwampCloneBinding" type="tns:SwampClonePortType">
<soap:binding transport="
http://schemas.xmlsoap.org/soap/http"
style="rpc"/>
<operation name="newScriptedFlow">
<soap:operation style="rpc" soapAction="newScriptedFlow"/>
<input name="input1">
<soap:body use="literal" namespace="http://
j2ee.netbeans.org/wsdl/SwampClone"/>
</input>
<output name="output1">
<soap:body use="literal" namespace="http://
j2ee.netbeans.org/wsdl/SwampClone"/>
</output>
</operation>
</binding>
<service name="service1">
<port name="port1" binding="tns:SwampCloneBinding">
<soap:address location="
http://localhost:28080/SOAP"/>
</port>
</service>
<plnk:partnerLinkType name="SwampClone1">
<!-- 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="SwampClonePortTypeRole"
portType="tns:SwampClonePortType"/>
</plnk:partnerLinkType>
</definitions>
</code>
The URL that is used to access the service should be pretty obvious,
but note that it is tailored to my local swamp instance. When I try
to access swamp from Java, I can see swamp get to work on my request
from the swamp log, process it, and return a valid SOAP response.
Unfortunately, the response isn't formatted the way Java is expecting.
javax.xml.ws.WebServiceException: Unexpected response element
newScriptedFlowResponse
expected: {
http://j2ee.netbeans.org/wsdl/
SwampClone}newScriptedFlowResponse
It's a namespace issue. I can't seem to change the WSDL file I
created without breaking Netbean's/Java's WSDL importer, so I'm
thinking I should dive into the swamp code to use some swampy
namespace where needed.
If anyone has an idea how to get this working, please share! Thanks!
Jeff