You are viewing a plain text version of this content. The canonical link for it is here.
Posted to docs@cocoon.apache.org by do...@cocoon.apache.org on 2005/01/09 23:37:04 UTC
[Cocoon Wiki] Updated: SOAPLogicsheet
Date: 2005-01-09T14:37:04
Editor: ChristophOberle
Wiki: Cocoon Wiki
Page: SOAPLogicsheet
URL: http://wiki.apache.org/cocoon/SOAPLogicsheet
no comment
Change Log:
------------------------------------------------------------------------------
@@ -13,18 +13,18 @@
The XML part of a typical SOAP request looks like:
-{{{
-<?xml version="1.0" encoding="UTF-8?>
-
-<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
- <SOAP-ENV:Body>
- <getPartnerData>
- <getPartnerDataRequest>
- <partnerNo>1</partnerNo>
- </getPartnerDataRequest>
- </getPartnerData>
- </SOAP-ENV:Body>
-</SOAP-ENV:Envelope>
+{{{
+<?xml version="1.0" encoding="UTF-8?>
+
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
+ <SOAP-ENV:Body>
+ <getPartnerData>
+ <getPartnerDataRequest>
+ <partnerNo>1</partnerNo>
+ </getPartnerDataRequest>
+ </getPartnerData>
+ </SOAP-ENV:Body>
+</SOAP-ENV:Envelope>
}}}
This XML data must be POSTed to the Webservice's URL
@@ -33,28 +33,28 @@
After serving the SOAP request the caller will get a HTTP reply which could look like:
-{{{
-<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
- <soapenv:Body>
- <getPartnerDataResponse
- soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" >
- <getPartnerDataReturn>
- <bpPerson>
- <birthdate>1960-01-01</birthdate>
- <nationality>DE</nationality>
- <lastname>Muster</lastname>
- <initials>E.E.</initials>
- <sex>1</sex>
- <fullname>Dr. Max E.E. Muster</fullname>
- <firstname>Max</firstname>
- <partnerNo>1</partnerNo>
- </bpPerson>
- </getPartnerDataReturn>
- </getPartnerDataResponse>
- </soapenv:Body>
-</soapenv:Envelope>
+{{{
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
+ <soapenv:Body>
+ <getPartnerDataResponse
+ soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" >
+ <getPartnerDataReturn>
+ <bpPerson>
+ <birthdate>1960-01-01</birthdate>
+ <nationality>DE</nationality>
+ <lastname>Muster</lastname>
+ <initials>E.E.</initials>
+ <sex>1</sex>
+ <fullname>Dr. Max E.E. Muster</fullname>
+ <firstname>Max</firstname>
+ <partnerNo>1</partnerNo>
+ </bpPerson>
+ </getPartnerDataReturn>
+ </getPartnerDataResponse>
+ </soapenv:Body>
+</soapenv:Envelope>
}}}
----
@@ -70,25 +70,25 @@
The SOAP call from above could be included in a xsp:page as:
-{{{
-<?xml version="1.0" encoding="ISO-8859-1"?>
-
-<xsp:page language="java"
- xmlns:xsp="http://apache.org/xsp"
- xmlns:xsp-request="http://apache.org/xsp/request/2.0"
- xmlns:soap="http://apache.org/xsp/soap/3.0"
- xmlns:xscript="http://apache.org/xsp/xscript/1.0"
- xmlns:log="http://apache.org/xsp/log/2.0">
- <page>
- <soap:call url="http://webservices.somewhere.org:80/partner">
- <getPartnerData>
- <getPartnerDataRequest>
- <partnerNo><xsp-request:get-parameter name="partnerID"/></partnerNo>
- </getPartnerDataRequest>
- </getPartnerData>
- </soap:call>
- </page>
-</xsp:page>
+{{{
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<xsp:page language="java"
+ xmlns:xsp="http://apache.org/xsp"
+ xmlns:xsp-request="http://apache.org/xsp/request/2.0"
+ xmlns:soap="http://apache.org/xsp/soap/3.0"
+ xmlns:xscript="http://apache.org/xsp/xscript/1.0"
+ xmlns:log="http://apache.org/xsp/log/2.0">
+ <page>
+ <soap:call url="http://webservices.somewhere.org:80/partner">
+ <getPartnerData>
+ <getPartnerDataRequest>
+ <partnerNo><xsp-request:get-parameter name="partnerID"/></partnerNo>
+ </getPartnerDataRequest>
+ </getPartnerData>
+ </soap:call>
+ </page>
+</xsp:page>
}}}
Here, the input parameter for the "query" (partnerNo) comes from the request parameter PartnerID.
@@ -99,84 +99,74 @@
the <soap:call> will be replaced by the SOAP result, and the next step of pipeline processing[[BR]]
will see the following:
-{{{
-<?xml version="1.0" encoding="UTF-8" ?>
-
-<page xmlns:xsp="http://apache.org/xsp"
- xmlns:xscript="http://apache.org/xsp/xscript/1.0"
- xmlns:soap="http://apache.org/xsp/soap/3.0"
- xmlns:xsp-session="http://apache.org/xsp/session/2.0"
- xmlns:xsp-request="http://apache.org/xsp/request/2.0"
- xmlns:log="http://apache.org/xsp/log/2.0">
- <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
- <soapenv:Body>
- <getPartnerDataResponse
- soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" >
- <getPartnerDataReturn>
- <bpPerson>
- <birthdate>1960-01-01</birthdate>
- <nationality>DE</nationality>
- <lastname>Muster</lastname>
- <initials>E.E.</initials>
- <sex>1</sex>
- <fullname>Dr. Max E.E. Muster</fullname>
- <firstname>Max</firstname>
- <partnerNo>4711</partnerNo>
- </bpPerson>
- </getPartnerDataReturn>
- </getPartnerDataResponse>
- </soapenv:Body>
- </soapenv:Envelope>
-</page>
+{{{
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<page xmlns:xsp="http://apache.org/xsp"
+ xmlns:xscript="http://apache.org/xsp/xscript/1.0"
+ xmlns:soap="http://apache.org/xsp/soap/3.0"
+ xmlns:xsp-session="http://apache.org/xsp/session/2.0"
+ xmlns:xsp-request="http://apache.org/xsp/request/2.0"
+ xmlns:log="http://apache.org/xsp/log/2.0">
+ <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
+ <soapenv:Body>
+ <getPartnerDataResponse
+ soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" >
+ <getPartnerDataReturn>
+ <bpPerson>
+ <birthdate>1960-01-01</birthdate>
+ <nationality>DE</nationality>
+ <lastname>Muster</lastname>
+ <initials>E.E.</initials>
+ <sex>1</sex>
+ <fullname>Dr. Max E.E. Muster</fullname>
+ <firstname>Max</firstname>
+ <partnerNo>4711</partnerNo>
+ </bpPerson>
+ </getPartnerDataReturn>
+ </getPartnerDataResponse>
+ </soapenv:Body>
+ </soapenv:Envelope>
+</page>
}}}
----
-=== What does not work ===
+=== How to connect to a web service via https:// ===
The current implementation of the SOAP logicsheet is not able to access webservices trough secure socket
-connections (https://... does not work!)
+connections (https://... does not work!) But it is not neccessary to extend Cocoon, you can use stunnel
+enable secure connections.
+The SOAP logic sheet calls a web service on a local http port, where stunnel is listening in client mode. This program
+does the ssl encryption and communicates wich the real web service on the remote server through https://
-=== to the cocoon developers: ===
+Steps to do:
+1. get stunnel from stunnel.org
-To have the SOAP logicsheet accept direct https connections, a little patch is needed in the SOAPHelper class:
+2. edit stunnel.conf
-The code which does the connection
-{{{
- if (System.getProperty("http.proxyHost") != null) {
- String proxyHost = System.getProperty("http.proxyHost");
- int proxyPort = Integer.parseInt(System.getProperty("http.proxyPort"));
- conn = new HttpConnection(proxyHost, proxyPort, host, port);
- } else {
- conn = new HttpConnection(host, port);
- }
+{{{
+foreground=yes
+client=yes
+debug=3
+pid=/tmp/stunnel.pid
+[https]
+accept=localhost:8585
+connect=somewhere.secure.org:443
+transparent=no
}}}
-has to be changed to
-{{{
- if (System.getProperty("http.proxyHost") != null) {
- String proxyHost = System.getProperty("http.proxyHost");
- int proxyPort = Integer.parseInt(System.getProperty("http.proxyPort"));
- conn = new HttpConnection(proxyHost, proxyPort, host, port);
- } else {
- if (url.getProtocol().equals("https") {
- conn = new HttpConnection(host, port, true);
- } else {
- conn = new HttpConnection(host, port);
- }
- }
-}}}
+In this example web service calls to http://localhost:8585 are redirected to https://somewhere.secure.org
-This API "!HttpConnection(host, port, security)" is depreceated.
-Therefore someone who knows Java and Cocoon should look at it ;-)
+3. start stunnel (stunnel stunnel.conf)
-But it works...
+Thanks to Larissa for this information
ChristophOberle