First of all thanks for reading.
I'm new to SOA, and I came from .Net world.
I'm Trying to understand how to set a custom header in my soap call to the webService I've follow the Michael Czapski "Handling SOAP Headers in BPEL" but I can't reproduce that in my own scenario.
Let me explain.
This is the webservice I want to invoke:
public class Service : System.Web.Services.WebService
{
public MioHeader AHeader = new MioHeader();
[WebMethod]
[SoapHeader("AHeader")]
public string AMethode(string aVar)
{
return aVar + AHeader.TokenInHeader;
}
}
MioHeader is a class with a property Token of type string
WSDL:
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://tempuri.org/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/">
<s:element name="AMethode">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="aVar" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="AMethodeResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="AMethodeResult" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="MioHeader" type="tns:MioHeader" />
<s:complexType name="MioHeader">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="TokenInHeader" type="s:string" />
</s:sequence>
<s:anyAttribute />
</s:complexType>
</s:schema>
</wsdl:types>
<wsdl:message name="AMethodeSoapIn">
<wsdl:part name="parameters" element="tns:AMethode" />
</wsdl:message>
<wsdl:message name="AMethodeSoapOut">
<wsdl:part name="parameters" element="tns:AMethodeResponse" />
</wsdl:message>
<wsdl:message name="AMethodeMioHeader">
<wsdl:part name="MioHeader" element="tns:MioHeader" />
</wsdl:message>
<wsdl:portType name="ServiceSoap">
<wsdl:operation name="AMethode">
<wsdl:input message="tns:AMethodeSoapIn" />
<wsdl:output message="tns:AMethodeSoapOut" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="ServiceSoap" type="tns:ServiceSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="AMethode">
<soap:operation soapAction="http://tempuri.org/AMethode" style="document" />
<wsdl:input>
<soap:body use="literal" parts="parameters" />
<soap:header message="tns:AMethodeMioHeader" part="MioHeader" use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" parts="parameters" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="Service">
<wsdl:port name="ServiceSoap" binding="tns:ServiceSoap">
<soap:address location="http://athena/Test/service.asmx" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
http://img80.imageshack.us/img80/4706/imago.png
<?xml version="1.0" encoding="UTF-8"?>
<process
name="bpelHeader"
targetNamespace="http://enterprise.netbeans.org/bpel/BpelHeader/bpelHeader"
xmlns:tns="http://enterprise.netbeans.org/bpel/BpelHeader/bpelHeader"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
xmlns:sxt="http://www.sun.com/wsbpel/2.0/process/executable/SUNExtension/Trace"
xmlns:sxed="http://www.sun.com/wsbpel/2.0/process/executable/SUNExtension/Editor"
xmlns:sxeh="http://www.sun.com/wsbpel/2.0/process/executable/SUNExtension/ErrorHandling" xmlns:sxed2="http://www.sun.com/wsbpel/2.0/process/executable/SUNExtension/Editor2" xmlns:ns0="http://tempuri.org/">
<import namespace="http://enterprise.netbeans.org/bpel/service.asmxWrapper" location="service.asmxWrapper.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"/>
<import namespace="http://tempuri.org/" location="http://athena/Test/service.asmx?wsdl" importType="http://schemas.xmlsoap.org/wsdl/"/>
<import namespace="http://xml.netbeans.org/schema/AXmlSchema" location="AXmlSchema.xsd" importType="http://www.w3.org/2001/XMLSchema"/>
<import namespace="http://j2ee.netbeans.org/wsdl/BpelHeader/TestWSDL" location="TestWSDL.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"/>
<partnerLinks>
<partnerLink name="PartnerLinkTEST" xmlns:tns="http://j2ee.netbeans.org/wsdl/BpelHeader/TestWSDL" partnerLinkType="tns:TestWSDL" myRole="TestWSDLPortTypeRole"/>
<partnerLink name="PartnerLinkTestInvoke" xmlns:tns="http://enterprise.netbeans.org/bpel/service.asmxWrapper" partnerLinkType="tns:ServiceSoapLinkType" partnerRole="ServiceSoapRole"/>
</partnerLinks>
<variables>
<variable name="TestWSDLOperationOut" xmlns:tns="http://j2ee.netbeans.org/wsdl/BpelHeader/TestWSDL" messageType="tns:TestWSDLOperationResponse"/>
<variable name="TestWSDLOperationIn" xmlns:tns="http://j2ee.netbeans.org/wsdl/BpelHeader/TestWSDL" messageType="tns:TestWSDLOperationRequest"/>
<variable name="AMethodeOut" xmlns:tns="http://tempuri.org/" messageType="tns:AMethodeSoapOut"/>
<variable name="AMethodeIn" xmlns:tns="http://tempuri.org/" messageType="tns:AMethodeSoapIn"/>
</variables>
<sequence>
<receive name="Receive1" createInstance="yes" partnerLink="PartnerLinkTEST" operation="TestWSDLOperation" xmlns:tns="http://j2ee.netbeans.org/wsdl/BpelHeader/TestWSDL" portType="tns:TestWSDLPortType" variable="TestWSDLOperationIn"/>
<assign name="Assign1">
<copy>
<from variable="TestWSDLOperationIn" part="in"/>
<to>$AMethodeIn.parameters/ns0:aVar</to>
</copy>
</assign>
<invoke name="InvokeTest" partnerLink="PartnerLinkTestInvoke" operation="AMethode" xmlns:tns="http://tempuri.org/" portType="tns:ServiceSoap" inputVariable="AMethodeIn" outputVariable="AMethodeOut"/>
<assign name="Assign2">
<copy>
<from>$AMethodeOut.parameters/ns0:AMethodeResult</from>
<to variable="TestWSDLOperationOut" part="out"/>
</copy>
</assign>
<reply name="Reply1" partnerLink="PartnerLinkTEST" operation="TestWSDLOperation" xmlns:tns="http://j2ee.netbeans.org/wsdl/BpelHeader/TestWSDL" portType="tns:TestWSDLPortType" variable="TestWSDLOperationOut"/>
</sequence>
</process>
Could please someone put me in the right way?
Many regards and sorry for my English, I'm from Italy.