Try the following to add headers...
SOAPHeaderElement unknownHeader =
new SOAPHeaderElement("http://example.org",
"unknown",
"Nobody understands me!");
unknownHeader.setMustUnderstand(true);
_call.addHeader(unknownHeader);
-- dims
Excerpt from:
http://cvs.apache.org/viewcvs/xml-axis/java/test/wsdl/soap12/additional/WhiteMesaSoap12AddTestSvcTestCase.java
--- Chris Means <[EMAIL PROTECTED]> wrote:
> Yes.
>
> None of the Java/Axis projects appear to use SOAP Headers.
>
> Here's a snippet from one of the source files:
>
> // Call the MapPoint .NET server to calculate the route.
> // Unfortunately, Axis doesn't let us pass a UserInfoRouteHeader
> // to the route service, so we cannot specify the distance units to
> // use for the route. Instead, we use the default (kilometers) and
> // convert to the desired units in the DrivingDirectionsWindow.
>
> Are you aware of one that does? Or is there something I missed?
>
> > -----Original Message-----
> > From: Davanum Srinivas [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, July 23, 2003 5:54 AM
> > To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> > Subject: Re: Problems with SOAP Header and .NET service
> >
> >
> > Did you see the code posted by these guys? http://demo.mappoint.net/
> >
> > -- dims
> >
> > --- Chris Means <[EMAIL PROTECTED]> wrote:
> > > Hi,
> > >
> > > I've been bashing my head against the wall trying to figure
> > this out...it's
> > > not as helpful as reading the documentation, but it hurts just
> > as much <g>.
> > >
> > > I'm successfully using an Axis 1.1 client to talk to a .NET
> > service. The
> > > WSDL2Java tool worked well for the most part, but there were one or two
> > > tweaks I had to make as Axis doesn't yet appear to support the
> > <list> type
> > > that M$ loves so much.
> > >
> > > My remaining stumbling block appears to be with sending the
> > SOAP Headers the
> > > way .NET wants to get them. (The SOAP Body is perfect.)
> > >
> > > I've successfully been using the setHeader method of the Stub to add new
> > > headers, however, Axis keeps adding xsi:type attributes,
> > despite the fact
> > > that I've got:
> > >
> > > _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR,
> > > Boolean.FALSE);
> > >
> > > (Does this setting not apply to headers added via the Stub? I did try
> > > adding a header via _call.addHeader, but that didn't seem to do
> > the trick
> > > either.)
> > >
> > > So, instead of getting:
> > >
> > > <soapenv:Header>
> > > <UserInfoRouteHeader xmlns="http://s.mappoint.net/mappoint-30/">
> > > <DefaultDistanceUnit>Mile</DefaultDistanceUnit>
> > > </UserInfoRouteHeader>
> > > </soapenv:Header>
> > >
> > > I get:
> > >
> > > <soapenv:Header>
> > > <ns1:UserInfoRouteHeader soapenv:mustUnderstand="0"
> > > xsi:type="ns1:UserInfoRouteHeader"
> > > xmlns:ns1="http://s.mappoint.net/mappoint-30/">
> > > <DefaultDistanceUnit>Mile</DefaultDistanceUnit>
> > > </ns1:UserInfoRouteHeader>
> > > </soapenv:Header>
> > >
> > > Here's how I'm adding the header:
> > >
> > > UserInfoRouteHeader userInfo = new UserInfoRouteHeader () ;
> > > userInfo.setDefaultDistanceUnit (DistanceUnit.Mile) ;
> > >
> > > setHeader ("http://s.mappoint.net/mappoint-30/",
> > > "UserInfoRouteHeader",
> > > userInfo) ;
> > >
> > > Can anyone point me in the right direction?
> > >
> > > Thanks.
> > >
> > > -Chris
> > >
> > >
> >
> >
> > =====
> > Davanum Srinivas - http://webservices.apache.org/~dims/
> >
> > __________________________________
> > Do you Yahoo!?
> > Yahoo! SiteBuilder - Free, easy-to-use web site design software
> > http://sitebuilder.yahoo.com
> >
>
>
=====
Davanum Srinivas - http://webservices.apache.org/~dims/
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com