Listing 1

<definitions xmlns:tns1="http://xmlns.oracle.com/WCFAddr"
             xmlns="http://schemas.xmlsoap.org/wsdl/"
             xmlns:ns1="http://tempuri.org/"
             xmlns:plnk="http://schemas.xmlsoap.org/ws/2003/05/partner-link/"
             xmlns:ns2="http://www.w3.org/2005/08/addressing"
             xmlns:client="http://xmlns.oracle.com/WCFAddr"
             xmlns:wsa10="http://www.w3.org/2005/08/addressing"
             xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
             targetNamespace="http://xmlns.oracle.com/WCFAddr" name="WCFAddr">
   <types>
      <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
         <xsd:import namespace="http://www.w3.org/2005/08/addressing"
                     schemaLocation="http://www.w3.org/2006/03/addressing/ws-addr.xsd"/>
      </xsd:schema>
      <!-- other types -->
   </types>
   
   <!-- definition of messages -->
   <message name="wsaRelatesTo">
      <part name="parameters" element="wsa10:RelatesTo"/>
   </message>
   <message name="wsaReplyTo">
      <part name="parameters" element="wsa10:ReplyTo"/>
   </message>
   <message name="wsaMessageId">
      <part name="parameters" element="wsa10:MessageID"/>
   </message>
   
   <!-- Port types -->
   
   <!-- Binding -->
   <binding name="WCFAddrBinding" type="tns1:WCFAddr">
      <soap:binding style="document"
                    transport="http://schemas.xmlsoap.org/soap/http"/>
      <operation name="initiate">
         <soap:operation soapAction="initiate" style="document"/>
         <input>
            <soap:header message="tns1:wsaReplyTo" part="parameters" use="literal"/>
            <soap:header message="tns1:wsaMessageId" part="parameters" use="literal"/>
            <soap:body use="literal"/>
         </input>
         <output>
            <soap:body use="literal"/>
         </output>
      </operation>
   </binding>
</definitions>



Listing 2

<assign name="endpointAssign">
    <copy>
        <from>
            <EndpointReference xmlns="http://schemas.xmlsoap.org/ws/2003/03/addressing"
                               xmlns:ns1="http://tempuri.org/">
                <Address/>
                <ServiceName/>
            </EndpointReference>
        </from>
        <to variable="wcfEndpoint"/>
    </copy>
    <copy>
        <from variable="wcfServiceAddr" part="parameters"
              query="/ns2:ReplyTo/ns2:Address"/>
        <to variable="wcfEndpoint" query="/ns3:EndpointReference/ns3:Address"/>
    </copy>
    <copy>
        <from expression="'ns1:wcfService'"/>
        <to variable="wcfEndpoint"
            query="/ns3:EndpointReference/ns3:ServiceName"/>
    </copy>
</assign>


Listing 3

HttpTransportBindingElement addrBindingElement = new HttpTransportBindingElement();
addrBindingElement.ManualAddressing = true;

TextMessageEncodingBindingElement encElement = new TextMessageEncodingBindingElement();
encElement.AddressingVersion = AddressingVersion.WSAddressing10;
encElement.MessageVersion = MessageVersion.Soap11WSAddressing10;

CustomBinding opbinding = new CustomBinding(encElement, addrBindingElement);
EndpointAddress opendpoint = new EndpointAddress(WCF Service Address...); 
ChannelFactory<IOperationCallback> factory = new ChannelFactory<IOperationCallback>(opbinding, opendpoint);
IOperationCallback op = factory.CreateChannel();

using (new OperationContextScope((IContextChannel)op))
{
    MessageVersion CurrentVersion = OperationContext.Current.OutgoingMessageHeaders.MessageVersion;
    OperationContext.Current.OutgoingMessageHeaders.ReplyTo = new EndpointAddress(opendpoint);
    OperationContext.Current.OutgoingMessageHeaders.To = new Uri(Oracle BPEL Process Address...);
    OperationContext.Current.OutgoingMessageHeaders.MessageId = new UniqueId();
    //Execute operation...
 }



Listing 4

public interface Icalculator
{
    [OperationContract]
    int Add(int param1, int param2);
}

[ServiceBehavior(IncludeExceptionDetailInFaults=true)]
public class CalculatorService : ICalculator
{
    public int Add(int param1, int param2)
    {
        Int result = n1 + n2; 
        return result;
    }
}



Listing 5

   <bindings>
      <wsHttpBinding>
         <!-- Username binding -->
         <binding name="Binding1">
            <security mode="Message">
               <message clientCredentialType="UserName"/>
            </security>
         </binding>
      </wsHttpBinding>
   </bindings>

   <behaviors>
      <serviceBehaviors>
         <behavior name="CalculatorServiceBehavior"
                   includeExceptionDetailInFaults="True">
            <serviceCredentials>
               <!-- 
                     The serviceCredentials behavior allows one to specify a custom
                     validator for username/password combinations.
                -->
               <userNameAuthentication userNamePasswordValidati0onMode="Custom"
			     customUserNamePasswordValidatorType="OracleWCF.Samples.CalculatorService+MyUserNameValidator,
				  service"/>
            </serviceCredentials>
         </behavior>
      </serviceBehaviors>
   </behaviors>



Listing 6

<process name="InteropPrj" targetNamespace="http://xmlns.oracle.com/InteropPrj"
         xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
         xmlns:xp20="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.Xpath20"
         xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
         xmlns:ns4="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
         xmlns:ns1="http://tempuri.org/"
         xmlns:ldap="http://schemas.oracle.com/xpath/extension/ldap"
         xmlns:xsd="http://www.w3.org/2001/XMLSchema"
         xmlns:client="http://xmlns.oracle.com/InteropPrj"
         xmlns:bpelx="http://schemas.oracle.com/bpel/extension"
         xmlns:ora="http://schemas.oracle.com/xpath/extension"
         xmlns:orcl="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.ExtFunc">
        <partnerLinks>
                <partnerLink name="client" partnerLinkType="client:InteropPrj"
                             myRole="InteropPrjProvider"/>
                <partnerLink name="SecureSrv" partnerRole="ServiceSoap_Role"
                             partnerLinkType="ns1:ServiceSoap_PL"/>
        </partnerLinks>
        <variables>
                <!-- Reference to the message passed as input during initiation -->
                <variable name="inputVariable"
                          messageType="client:InteropPrjRequestMessage"/>
                <!--  
                      Reference to the message that will be returned to the requester
                      -->
                <variable name="outputVariable"
                          messageType="client:InteropPrjResponseMessage"/>
                <variable name="msgIn" messageType="ns1:AddSoapIn"/>
                <variable name="msgout" messageType="ns1:AddSoapOut"/>
                <variable name="wsseheaders" element="ns4:Security"/>
        </variables>
        <sequence name="main">
                <!-- Receive steps -->
                <assign name="Assign_1">
                        ...Copy Rules
                        <copy>
                                <from>
                                        <wsse:Security 
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
                                                <wsse:UsernameToken 
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
                                                        <wsse:Username>User1</wsse:Username>
<wsse:Password
 Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">
  Password1</wsse:Password>
                                                </wsse:UsernameToken>
                                        </wsse:Security>
                                </from>
                                <to variable="wsseheaders"/>
                        </copy>
                </assign>
                <invoke name="Invoke_1" partnerLink="SecureSrv"
                        portType="ns1:MathService_ASPNetSoap" operation="Add"
                        inputVariable="msgIn" outputVariable="msgout"
                        bpelx:inputHeaderVariable="wsseheaders"/>
                <!-- Final steps -->
        </sequence>
</process>



Listing 7

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <soap:Header>
                <wsse:Security soap:mustUnderstand="1"
                               xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
                               xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
                        <wsse:UsernameToken xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
                                            wsu:Id="SecurityToken-941458a9-6eff-4bc7-9d56-c6833ff249d4">
                                <wsse:Username>ok</wsse:Username>
<wsse:Password
Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">ko
</wsse:Password>
                                <wsse:Nonce>yHOCbdMAoejJz8l1PDi3Fw==</wsse:Nonce>
                                <wsu:Created>2006-02-18T15:52:32Z</wsu:Created>
                        </wsse:UsernameToken>
                </wsse:Security>
        </soap:Header>
        <soap:Body>
                <Add xmlns="http://tempuri.org/">
                        <param1>12</param1>
                        <param2>23</param2>
                </Add>
        </soap:Body>
</soap:Envelope>