You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Matt Brown <mt...@gmail.com> on 2011/04/14 14:41:18 UTC

Defining Soap Headers in an axis service

I'm need to replicate an exising web service written in .net, but I've
having problems copying the AuthHeader part.
To me, it looks like I just need to define this in the soap header, then
this would be implemented automatically on the .net side when it reads the
wsdl
I thought I may be able to do this via the server-config.wsdd, but I've
searched and can't find any info on how to do this.
Can anyone point me in the right direction please?
Many thanks for your help.

The existing soap request looks like

POST /WebServiceCiberbit.asmx HTTP/1.1
Host: tagsmanager.sybase.pt
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length




<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">



  <soap12:Header>
    <AuthHeader xmlns="http://microsoft.com/webservices/">
      <Username>string</Username>



      <Password>string</Password>
    </AuthHeader>
  </soap12:Header>
  <soap12:Body>
    <UploadCompressedXMLAsStream xmlns="http://microsoft.com/webservices/">



      <memoryStream>
        <Capacity>int</Capacity>
      </memoryStream>
    </UploadCompressedXMLAsStream>
  </soap12:Body>
</soap12:Envelope>




The service is called in C# using the following
	using (var ws = new MyWebService())
    {
		AuthHeader header = new AuthHeader();
		header.Username = 'username';
		header.Password = 'password';



		ws.AuthHeaderValue = header;

		XMLFileUploadResult ret = ws.UploadCompressedXMLAsByteArray(compressedData);
}