Tom:
 
What is your problem? Doesn't it work? So below you will find an example I found:
 
        Element emailElem = doc.createElementNS( "http://any.namespace.com",  "EMail");
        emailElem.appendChild( ... );
        SOAPEnvelope reqEnv = new SOAPEnvelope();
        reqEnv.addHeader( new SOAPHeader(emailElem ));
        reqEnv.addBodyElement( ... );
       
        // Invoke the web service
        Call call = new Call( url );
        SOAPEnvelope respEnv = call.invoke(reqEnv);
I hope it works like this.
 
best regards
Matthias Wimmer
-----Original Message-----
From: Tom Leuntjens [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 11, 2002 7:01 AM
To: [EMAIL PROTECTED]
Subject: Correct way to add Apache SOAP Header ?

Hi,
So
far im creating the call and i get this :
System.Web.Services.Protocols.SoapHeaderException: Server did not find required Version SOAP header in the message.
So I have been trying to add the header like this but to no avail ..

 

 

// create the header
Header myHeader = new Header();
myHeader.declareNamespace("Version", "");
 
myHeader.setAttribute(new QName("", "Identification"), "SKARABEEPRO");
 
myHeader.setAttribute(new QName("", "Major"), "0");
myHeader.setAttribute(new QName("", "Minor"), "0");
myHeader.setAttribute(new QName("", "Revision"), "0");
myHeader.setAttribute(new QName("", "Build"), "0");
 
//add the header to the call ...
call.setHeader(myHeader);


Can somebody can give me some more info on how to do this ? What is the correct way to add the header (details below)? Don't seem to find any info about it ...
Any help is appreciated ..
Thanx
Regards,
Tom

The service requires this call:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Header>
    <Version Identification="SKARABEEPRO" Major="0" Minor="0" Build="0" Revision="0" xmlns="leftthisouttopost" />
  </soap:Header>
  <soap:Body>
    <Ping xmlns="leftthisouttopost" />
  </soap:Body>
</soap:Envelope>


The toString() of the call (for my code at the time that doesn't work) gives this :

[Header=[Attributes={ Build="0" Revision="0" xmlns:Version="" Identification="SK
ARABEEPRO" Minor="0" Major="0"}] [HeaderEntries={}]] [methodName=Ping] [targetOb
jectURI=leftthisouttopostonforum] [encodingStyleURI=Co
nstants.NS_URI_SOAP_ENC] [SOAPContext=[Parts={}]] [Params={}]

 

Reply via email to