You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ode.apache.org by Arun Jain <ja...@gmail.com> on 2017/09/12 08:44:49 UTC

Invoke secured webservice using ode bpel

Hi,

I'm using eclipse bpel designer and trying to invoke a external soap
service which requires custom headers to be passed.

I'm using ode version 1.3.7 and it is deployed on Apache Tomcat Server 9.0

I have followed instructions from "http://ode.apache.org/http-
authentication.html"

Here is what I have done:

1. Following schema added to service wsdl
<xsd:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="urn:ode.apache.org/authentication"
elementFormDefault="qualified">
    <xsd:element name="authenticate">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element name="username" type="xsd:string"
 minOccurs="0" maxOccurs="1"/>
                <xsd:element name="password" type="xsd:string"
 minOccurs="0" maxOccurs="1"/>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>

</xsd:schema>

2. Input message updated as below
    <wsdl:message name="getModules">
        <wsdl:part element="tns:getModules" name="parameters"/>
        <wsdl:part name="authenticate" element="auth:authenticate"/>  <!--
Additional message part-->

    </wsdl:message>
3. Authenticate part updated as below in BPEL
    <bpel:assign validate="no" name="Assign2">
         <bpel:copy>
            <bpel:from><bpel:literal><authenticate xmlns="urn:
ode.apache.org/authentication" xmlns:xsi="http://www.w3.org/
2001/XMLSchema-instance">
             <username>system</username><password>admin</password></
authenticate></bpel:literal></bpel:from>
            <bpel:to variable="TririgaPLRequest"
part="authenticate"></bpel:to>
        </bpel:copy>

    </bpel:assign>

4. The request message is updated with additional message part as follows
after invoke
<message>
<parameters>
<getModules xmlns="http://xyz.com" xmlns:tns="http://xyz.com" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"/>
</parameters>
<authenticate>
<authenticate xmlns="urn:ode.apache.org/authentication" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance">
                <username>system</username>
<password>admin</password>
</authenticate>
</authenticate>

</message>
5.  Getting the following response from service

        Error sending message (mex={PartnerRoleMex#hqejbhcnphrclmbblfgmjg
[PID {http://getModules <http://getmodules/>}GetModulesP-2312]

calling org.apache.ode.bpel.epr.WSAEndpoint@1090849.getModules(...) Status
ASYNC}): Transport error: 401 Error: Unauthorized


Thanks,

Arun

Re: Invoke secured webservice using ode bpel

Posted by Sathwik B P <sa...@gmail.com>.
Let me address your initial post first.

4. Your request message contains the authenticate element and it should not
be there. The element should not be part of the soap body or header.
To do that you need to explicitly specify the body part under the wsdl
binding section like this assuming "parameters" is the name of the message
part, so it looks like below.
<soap:body use="literal" parts="parameters"/>

Are you sure what headers do you want to send. REMOTE_USER is probably used
to indicate an pre authenticated user and it is set by the reverse proxies
before delegating the request to the backend server.
So just make sure with the external service provider what headers are they
expecting? Is it Http Auth header or REMOTE_USER header.

If you still want to send REMOTE_USER http header then set it this way in
the endpoint file. Replace the namespace and service name as per the
external service you are invoking.
alias.hw_ns=http://ws.test
hw_ns.HelloWorldWS.ode.http.default-headers.REMOTE_USER=system

On Tue, Sep 12, 2017 at 3:52 PM, Arun Jain <ja...@gmail.com> wrote:

> Below is the list of headers that should go with the request
>
> "POST /tririga/ws/TririgaWS HTTP/1.1[\r][\n]"
> "Accept-Encoding: gzip,deflate[\r][\n]"
> "Content-Type: application/soap+xml;charset=UTF-8[\r][\n]"
> "REMOTE_USER: system[\r][\n]"
> "Content-Length: 549[\r][\n]"
> "Host: 10.73.45.87:7002[\r][\n]"
> "Connection: Keep-Alive[\r][\n]"
> "User-Agent: Apache-HttpClient/4.1.1 (java 1.5)[\r][\n]"
>
> All the above headers except REMOTE_USER goes by default. I need to be able
> to set the REMOTE_USER and send it with other headers. You will find in my
> first mail I used username and password from authenticate schema as setting
> username and password header instead of REMOTE_USER header also works for
> me, but I want to use REMOTE_USER and not username and password header.
>
> Thanks,
> Arun
>
> On Tue, Sep 12, 2017 at 3:19 PM, Arun Jain <ja...@gmail.com> wrote:
>
> > Hi Sathwik,
> >
> > I want to pass custom http header
> >
> > Thanks,
> > Arun
> >
> > On Sep 12, 2017 14:50, "Sathwik B P" <sa...@gmail.com> wrote:
> >
> >> What do you mean by custom headers?
> >> Do you want to pass HTTP Basic Auth headers or custom Soap Headers?
> >>
> >> On Tue, Sep 12, 2017 at 2:14 PM, Arun Jain <ja...@gmail.com>
> wrote:
> >>
> >> > Hi,
> >> >
> >> > I'm using eclipse bpel designer and trying to invoke a external soap
> >> > service which requires custom headers to be passed.
> >> >
> >> > I'm using ode version 1.3.7 and it is deployed on Apache Tomcat Server
> >> 9.0
> >> >
> >> > I have followed instructions from "http://ode.apache.org/http-
> >> > authentication.html"
> >> >
> >> > Here is what I have done:
> >> >
> >> > 1. Following schema added to service wsdl
> >> > <xsd:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> >> > targetNamespace="urn:ode.apache.org/authentication"
> >> > elementFormDefault="qualified">
> >> >     <xsd:element name="authenticate">
> >> >         <xsd:complexType>
> >> >             <xsd:sequence>
> >> >                 <xsd:element name="username" type="xsd:string"
> >> >  minOccurs="0" maxOccurs="1"/>
> >> >                 <xsd:element name="password" type="xsd:string"
> >> >  minOccurs="0" maxOccurs="1"/>
> >> >             </xsd:sequence>
> >> >         </xsd:complexType>
> >> >     </xsd:element>
> >> >
> >> > </xsd:schema>
> >> >
> >> > 2. Input message updated as below
> >> >     <wsdl:message name="getModules">
> >> >         <wsdl:part element="tns:getModules" name="parameters"/>
> >> >         <wsdl:part name="authenticate" element="auth:authenticate"/>
> >> <!--
> >> > Additional message part-->
> >> >
> >> >     </wsdl:message>
> >> > 3. Authenticate part updated as below in BPEL
> >> >     <bpel:assign validate="no" name="Assign2">
> >> >          <bpel:copy>
> >> >             <bpel:from><bpel:literal><authenticate xmlns="urn:
> >> > ode.apache.org/authentication" xmlns:xsi="http://www.w3.org/
> >> > 2001/XMLSchema-instance">
> >> >              <username>system</username><password>admin</password></
> >> > authenticate></bpel:literal></bpel:from>
> >> >             <bpel:to variable="TririgaPLRequest"
> >> > part="authenticate"></bpel:to>
> >> >         </bpel:copy>
> >> >
> >> >     </bpel:assign>
> >> >
> >> > 4. The request message is updated with additional message part as
> >> follows
> >> > after invoke
> >> > <message>
> >> > <parameters>
> >> > <getModules xmlns="http://xyz.com" xmlns:tns="http://xyz.com"
> >> xmlns:xsi="
> >> > http://www.w3.org/2001/XMLSchema-instance"/>
> >> > </parameters>
> >> > <authenticate>
> >> > <authenticate xmlns="urn:ode.apache.org/authentication" xmlns:xsi="
> >> > http://www.w3.org/2001/XMLSchema-instance">
> >> >                 <username>system</username>
> >> > <password>admin</password>
> >> > </authenticate>
> >> > </authenticate>
> >> >
> >> > </message>
> >> > 5.  Getting the following response from service
> >> >
> >> >         Error sending message (mex={PartnerRoleMex#hqejbhcnp
> >> hrclmbblfgmjg
> >> > [PID {http://getModules <http://getmodules/>}GetModulesP-2312]
> >> >
> >> > calling org.apache.ode.bpel.epr.WSAEndpoint@1090849.getModules(...)
> >> Status
> >> > ASYNC}): Transport error: 401 Error: Unauthorized
> >> >
> >> >
> >> > Thanks,
> >> >
> >> > Arun
> >> >
> >>
> >
>

Re: Invoke secured webservice using ode bpel

Posted by Arun Jain <ja...@gmail.com>.
Below is the list of headers that should go with the request

"POST /tririga/ws/TririgaWS HTTP/1.1[\r][\n]"
"Accept-Encoding: gzip,deflate[\r][\n]"
"Content-Type: application/soap+xml;charset=UTF-8[\r][\n]"
"REMOTE_USER: system[\r][\n]"
"Content-Length: 549[\r][\n]"
"Host: 10.73.45.87:7002[\r][\n]"
"Connection: Keep-Alive[\r][\n]"
"User-Agent: Apache-HttpClient/4.1.1 (java 1.5)[\r][\n]"

All the above headers except REMOTE_USER goes by default. I need to be able
to set the REMOTE_USER and send it with other headers. You will find in my
first mail I used username and password from authenticate schema as setting
username and password header instead of REMOTE_USER header also works for
me, but I want to use REMOTE_USER and not username and password header.

Thanks,
Arun

On Tue, Sep 12, 2017 at 3:19 PM, Arun Jain <ja...@gmail.com> wrote:

> Hi Sathwik,
>
> I want to pass custom http header
>
> Thanks,
> Arun
>
> On Sep 12, 2017 14:50, "Sathwik B P" <sa...@gmail.com> wrote:
>
>> What do you mean by custom headers?
>> Do you want to pass HTTP Basic Auth headers or custom Soap Headers?
>>
>> On Tue, Sep 12, 2017 at 2:14 PM, Arun Jain <ja...@gmail.com> wrote:
>>
>> > Hi,
>> >
>> > I'm using eclipse bpel designer and trying to invoke a external soap
>> > service which requires custom headers to be passed.
>> >
>> > I'm using ode version 1.3.7 and it is deployed on Apache Tomcat Server
>> 9.0
>> >
>> > I have followed instructions from "http://ode.apache.org/http-
>> > authentication.html"
>> >
>> > Here is what I have done:
>> >
>> > 1. Following schema added to service wsdl
>> > <xsd:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
>> > targetNamespace="urn:ode.apache.org/authentication"
>> > elementFormDefault="qualified">
>> >     <xsd:element name="authenticate">
>> >         <xsd:complexType>
>> >             <xsd:sequence>
>> >                 <xsd:element name="username" type="xsd:string"
>> >  minOccurs="0" maxOccurs="1"/>
>> >                 <xsd:element name="password" type="xsd:string"
>> >  minOccurs="0" maxOccurs="1"/>
>> >             </xsd:sequence>
>> >         </xsd:complexType>
>> >     </xsd:element>
>> >
>> > </xsd:schema>
>> >
>> > 2. Input message updated as below
>> >     <wsdl:message name="getModules">
>> >         <wsdl:part element="tns:getModules" name="parameters"/>
>> >         <wsdl:part name="authenticate" element="auth:authenticate"/>
>> <!--
>> > Additional message part-->
>> >
>> >     </wsdl:message>
>> > 3. Authenticate part updated as below in BPEL
>> >     <bpel:assign validate="no" name="Assign2">
>> >          <bpel:copy>
>> >             <bpel:from><bpel:literal><authenticate xmlns="urn:
>> > ode.apache.org/authentication" xmlns:xsi="http://www.w3.org/
>> > 2001/XMLSchema-instance">
>> >              <username>system</username><password>admin</password></
>> > authenticate></bpel:literal></bpel:from>
>> >             <bpel:to variable="TririgaPLRequest"
>> > part="authenticate"></bpel:to>
>> >         </bpel:copy>
>> >
>> >     </bpel:assign>
>> >
>> > 4. The request message is updated with additional message part as
>> follows
>> > after invoke
>> > <message>
>> > <parameters>
>> > <getModules xmlns="http://xyz.com" xmlns:tns="http://xyz.com"
>> xmlns:xsi="
>> > http://www.w3.org/2001/XMLSchema-instance"/>
>> > </parameters>
>> > <authenticate>
>> > <authenticate xmlns="urn:ode.apache.org/authentication" xmlns:xsi="
>> > http://www.w3.org/2001/XMLSchema-instance">
>> >                 <username>system</username>
>> > <password>admin</password>
>> > </authenticate>
>> > </authenticate>
>> >
>> > </message>
>> > 5.  Getting the following response from service
>> >
>> >         Error sending message (mex={PartnerRoleMex#hqejbhcnp
>> hrclmbblfgmjg
>> > [PID {http://getModules <http://getmodules/>}GetModulesP-2312]
>> >
>> > calling org.apache.ode.bpel.epr.WSAEndpoint@1090849.getModules(...)
>> Status
>> > ASYNC}): Transport error: 401 Error: Unauthorized
>> >
>> >
>> > Thanks,
>> >
>> > Arun
>> >
>>
>

Re: Invoke secured webservice using ode bpel

Posted by Arun Jain <ja...@gmail.com>.
Hi Sathwik,

I want to pass custom http header

Thanks,
Arun

On Sep 12, 2017 14:50, "Sathwik B P" <sa...@gmail.com> wrote:

> What do you mean by custom headers?
> Do you want to pass HTTP Basic Auth headers or custom Soap Headers?
>
> On Tue, Sep 12, 2017 at 2:14 PM, Arun Jain <ja...@gmail.com> wrote:
>
> > Hi,
> >
> > I'm using eclipse bpel designer and trying to invoke a external soap
> > service which requires custom headers to be passed.
> >
> > I'm using ode version 1.3.7 and it is deployed on Apache Tomcat Server
> 9.0
> >
> > I have followed instructions from "http://ode.apache.org/http-
> > authentication.html"
> >
> > Here is what I have done:
> >
> > 1. Following schema added to service wsdl
> > <xsd:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> > targetNamespace="urn:ode.apache.org/authentication"
> > elementFormDefault="qualified">
> >     <xsd:element name="authenticate">
> >         <xsd:complexType>
> >             <xsd:sequence>
> >                 <xsd:element name="username" type="xsd:string"
> >  minOccurs="0" maxOccurs="1"/>
> >                 <xsd:element name="password" type="xsd:string"
> >  minOccurs="0" maxOccurs="1"/>
> >             </xsd:sequence>
> >         </xsd:complexType>
> >     </xsd:element>
> >
> > </xsd:schema>
> >
> > 2. Input message updated as below
> >     <wsdl:message name="getModules">
> >         <wsdl:part element="tns:getModules" name="parameters"/>
> >         <wsdl:part name="authenticate" element="auth:authenticate"/>
> <!--
> > Additional message part-->
> >
> >     </wsdl:message>
> > 3. Authenticate part updated as below in BPEL
> >     <bpel:assign validate="no" name="Assign2">
> >          <bpel:copy>
> >             <bpel:from><bpel:literal><authenticate xmlns="urn:
> > ode.apache.org/authentication" xmlns:xsi="http://www.w3.org/
> > 2001/XMLSchema-instance">
> >              <username>system</username><password>admin</password></
> > authenticate></bpel:literal></bpel:from>
> >             <bpel:to variable="TririgaPLRequest"
> > part="authenticate"></bpel:to>
> >         </bpel:copy>
> >
> >     </bpel:assign>
> >
> > 4. The request message is updated with additional message part as follows
> > after invoke
> > <message>
> > <parameters>
> > <getModules xmlns="http://xyz.com" xmlns:tns="http://xyz.com"
> xmlns:xsi="
> > http://www.w3.org/2001/XMLSchema-instance"/>
> > </parameters>
> > <authenticate>
> > <authenticate xmlns="urn:ode.apache.org/authentication" xmlns:xsi="
> > http://www.w3.org/2001/XMLSchema-instance">
> >                 <username>system</username>
> > <password>admin</password>
> > </authenticate>
> > </authenticate>
> >
> > </message>
> > 5.  Getting the following response from service
> >
> >         Error sending message (mex={PartnerRoleMex#
> hqejbhcnphrclmbblfgmjg
> > [PID {http://getModules <http://getmodules/>}GetModulesP-2312]
> >
> > calling org.apache.ode.bpel.epr.WSAEndpoint@1090849.getModules(...)
> Status
> > ASYNC}): Transport error: 401 Error: Unauthorized
> >
> >
> > Thanks,
> >
> > Arun
> >
>

Re: Invoke secured webservice using ode bpel

Posted by Sathwik B P <sa...@gmail.com>.
What do you mean by custom headers?
Do you want to pass HTTP Basic Auth headers or custom Soap Headers?

On Tue, Sep 12, 2017 at 2:14 PM, Arun Jain <ja...@gmail.com> wrote:

> Hi,
>
> I'm using eclipse bpel designer and trying to invoke a external soap
> service which requires custom headers to be passed.
>
> I'm using ode version 1.3.7 and it is deployed on Apache Tomcat Server 9.0
>
> I have followed instructions from "http://ode.apache.org/http-
> authentication.html"
>
> Here is what I have done:
>
> 1. Following schema added to service wsdl
> <xsd:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> targetNamespace="urn:ode.apache.org/authentication"
> elementFormDefault="qualified">
>     <xsd:element name="authenticate">
>         <xsd:complexType>
>             <xsd:sequence>
>                 <xsd:element name="username" type="xsd:string"
>  minOccurs="0" maxOccurs="1"/>
>                 <xsd:element name="password" type="xsd:string"
>  minOccurs="0" maxOccurs="1"/>
>             </xsd:sequence>
>         </xsd:complexType>
>     </xsd:element>
>
> </xsd:schema>
>
> 2. Input message updated as below
>     <wsdl:message name="getModules">
>         <wsdl:part element="tns:getModules" name="parameters"/>
>         <wsdl:part name="authenticate" element="auth:authenticate"/>  <!--
> Additional message part-->
>
>     </wsdl:message>
> 3. Authenticate part updated as below in BPEL
>     <bpel:assign validate="no" name="Assign2">
>          <bpel:copy>
>             <bpel:from><bpel:literal><authenticate xmlns="urn:
> ode.apache.org/authentication" xmlns:xsi="http://www.w3.org/
> 2001/XMLSchema-instance">
>              <username>system</username><password>admin</password></
> authenticate></bpel:literal></bpel:from>
>             <bpel:to variable="TririgaPLRequest"
> part="authenticate"></bpel:to>
>         </bpel:copy>
>
>     </bpel:assign>
>
> 4. The request message is updated with additional message part as follows
> after invoke
> <message>
> <parameters>
> <getModules xmlns="http://xyz.com" xmlns:tns="http://xyz.com" xmlns:xsi="
> http://www.w3.org/2001/XMLSchema-instance"/>
> </parameters>
> <authenticate>
> <authenticate xmlns="urn:ode.apache.org/authentication" xmlns:xsi="
> http://www.w3.org/2001/XMLSchema-instance">
>                 <username>system</username>
> <password>admin</password>
> </authenticate>
> </authenticate>
>
> </message>
> 5.  Getting the following response from service
>
>         Error sending message (mex={PartnerRoleMex#hqejbhcnphrclmbblfgmjg
> [PID {http://getModules <http://getmodules/>}GetModulesP-2312]
>
> calling org.apache.ode.bpel.epr.WSAEndpoint@1090849.getModules(...) Status
> ASYNC}): Transport error: 401 Error: Unauthorized
>
>
> Thanks,
>
> Arun
>