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 Albert Wong <at...@alumni.uci.edu> on 2003/06/13 01:14:06 UTC

Axis 1.1rc2 problem with adding Headers to Axis/SOAP requests

Hi,

I'm trying to add entries into the Axis/Soap Header.

Using env, Axis 1.1rc2 (with all the libraries provided in the lib directory
in the zip + Xerces 2.4.0) on IBM JDK 1.3 running in Websphere Studio 5.0.1

I followed the answer provided at http://ws.apache.org/axis/faq.html#faq18 

So I coded the below:

<!-- import -->

import java.net.URL;
import java.util.Vector;

import org.apache.axis.client.Stub;
import org.apache.axis.message.SOAPHeaderElement;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

<!-- code -->

			FOOInterfaceObjectServiceLocator foo =
				new FOOInterfaceObjectServiceLocator();

			URL serviceURL = new
URL(foo.getFOOServicesAddress());
			FOOInterfaceObject binding =
foo.getFOOServices(serviceURL);
			Stub s = (Stub) binding;

			SOAPHeaderElement header1 =
				new SOAPHeaderElement("", "sec:clientId",
username);
			header1.setMustUnderstand(true);
			s.setHeader(header1);

			SOAPHeaderElement header2 =
				new SOAPHeaderElement("", "sec:clientAuth",
password);
			header2.setMustUnderstand(true);
			s.setHeader(header2);

			StockCheckResponse response =
binding.stockCheck(request);
			log.debug("response = " + response.getServiceID());
	
log.debug(foo.getCall().getResponseMessage().getSOAPPartAsString());


When I run this, I get the below error.


<!-- error -->
2003-06-12 15:06:46,813; [main ]; DEBUG; ;
ProjectResourceBundle;getBundle(org.apache.axis,org.apache.axis.i18n,resourc
e,null,...)
2003-06-12 15:06:47,154; [main ]; DEBUG; ; ProjectResourceBundle;loadBundle:
Ignoring MissingResourceException: Can't find bundle for base name
org.apache.axis.resource, locale en_US
2003-06-12 15:06:47,164; [main ]; DEBUG; ; ProjectResourceBundle;Created
org.apache.axis.i18n.resource, linked to parent null
2003-06-12 15:06:47,264; [main ]; DEBUG; ;
ProjectResourceBundle;getBundle(org.apache.axis,org.apache.axis.utils,resour
ce,null,...)
2003-06-12 15:06:47,294; [main ]; DEBUG; ; ProjectResourceBundle;loadBundle:
Ignoring MissingResourceException: Can't find bundle for base name
org.apache.axis.utils.resource, locale en_US
2003-06-12 15:06:47,304; [main ]; DEBUG; ; ProjectResourceBundle;loadBundle:
Ignoring MissingResourceException: Can't find bundle for base name
org.apache.axis.resource, locale en_US
2003-06-12 15:06:47,304; [main ]; DEBUG; ; ProjectResourceBundle;Root
package not found, cross link to org.apache.axis.i18n.resource
2003-06-12 15:06:47,304; [main ]; DEBUG; ; ProjectResourceBundle;Root
package not found, cross link to org.apache.axis.i18n.resource
2003-06-12 15:06:47,304; [main ]; DEBUG; ;
ProjectResourceBundle;org.apache.axis.i18n.resource::handleGetObject(engineF
actory)
2003-06-12 15:06:47,304; [main ]; DEBUG; ;
EngineConfigurationFactoryFinder;Got EngineFactory:
org.apache.axis.configuration.EngineConfigurationFactoryDefault
2003-06-12 15:06:47,364; [main ]; DEBUG; ; AxisEngine;Enter:
AxisEngine::init
2003-06-12 15:06:50,118; [main ]; DEBUG; ;
ProjectResourceBundle;org.apache.axis.i18n.resource::handleGetObject(attachE
nabled)
2003-06-12 15:06:50,128; [main ]; DEBUG; ; JavaUtils;Attachment support is
enabled?  true
2003-06-12 15:06:50,178; [main ]; DEBUG; ;
JAFDataHandlerDeserializerFactory;Enter/Exit:
JAFDataHandlerDeserializerFactory(class java.lang.String,
{http://xml.apache.org/xml-soap}PlainText)
2003-06-12 15:06:50,348; [main ]; DEBUG; ;
ProjectResourceBundle;org.apache.axis.i18n.resource::handleGetObject(oddDigi
ts00)
2003-06-12 15:06:50,348; [main ]; DEBUG; ;
ProjectResourceBundle;org.apache.axis.i18n.resource::handleGetObject(badChar
s01)
2003-06-12 15:06:50,659; [main ]; DEBUG; ;
JAFDataHandlerDeserializerFactory;Enter/Exit:
JAFDataHandlerDeserializerFactory(class java.awt.Image,
{http://xml.apache.org/xml-soap}Image)
2003-06-12 15:06:50,679; [main ]; DEBUG; ;
JAFDataHandlerDeserializerFactory;Enter/Exit:
JAFDataHandlerDeserializerFactory(class javax.mail.internet.MimeMultipart,
{http://xml.apache.org/xml-soap}Multipart)
2003-06-12 15:06:50,689; [main ]; DEBUG; ;
JAFDataHandlerDeserializerFactory;Enter/Exit:
JAFDataHandlerDeserializerFactory(interface javax.xml.transform.Source,
{http://xml.apache.org/xml-soap}Source)
2003-06-12 15:06:50,699; [main ]; DEBUG; ;
JAFDataHandlerDeserializerFactory;Enter/Exit:
JAFDataHandlerDeserializerFactory(class
org.apache.axis.attachments.OctetStream,
{http://xml.apache.org/xml-soap}octetstream)
2003-06-12 15:06:50,709; [main ]; DEBUG; ;
JAFDataHandlerDeserializerFactory;Enter/Exit:
JAFDataHandlerDeserializerFactory()
2003-06-12 15:06:51,129; [main ]; DEBUG; ; AxisEngine;Exit: AxisEngine::init
2003-06-12 15:06:54,875; [main ]; DEBUG; ;
ProjectResourceBundle;org.apache.axis.i18n.resource::handleGetObject(excepti
on00)
2003-06-12 15:06:54,885; [main ]; ERROR; ; MessageElement;Exception:
java.lang.NullPointerException
	at
org.apache.axis.message.SOAPHeaderElement.outputImpl(SOAPHeaderElement.java:
226)
	at
org.apache.axis.message.MessageElement.output(MessageElement.java:779)
	at
org.apache.axis.message.MessageElement.getAsString(MessageElement.java:702)
	at
org.apache.axis.message.MessageElement.toString(MessageElement.java:830)
	at
com.ibm.sm.navy.webservices.client.ClientStockCheck.execute(ClientStockCheck
.java:76)
	at
com.ibm.sm.navy.webservices.client.test.ClientStockCheckTest.testNIIN(Client
StockCheckTest.java:79)
	at java.lang.reflect.Method.invoke(Native Method)
	at junit.framework.TestCase.runTest(TestCase.java:154)
	at junit.framework.TestCase.runBare(TestCase.java:127)
	at junit.framework.TestResult$1.protect(TestResult.java:106)
	at junit.framework.TestResult.runProtected(TestResult.java:124)
	at junit.framework.TestResult.run(TestResult.java:109)
	at junit.framework.TestCase.run(TestCase.java:118)
	at junit.framework.TestSuite.runTest(TestSuite.java:208)
	at junit.framework.TestSuite.run(TestSuite.java:203)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRu
nner.java:329)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.
java:218)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner
.java:151)
2003-06-12 15:06:54,895; [main ]; DEBUG; ; ClientStockCheck;
2003-06-12 15:06:54,915; [main ]; DEBUG; ;
ProjectResourceBundle;org.apache.axis.i18n.resource::handleGetObject(excepti
on00)
2003-06-12 15:06:55,125; [main ]; ERROR; ; MessageElement;Exception:
java.lang.NullPointerException
	at
org.apache.axis.message.SOAPHeaderElement.outputImpl(SOAPHeaderElement.java:
226)
	at
org.apache.axis.message.MessageElement.output(MessageElement.java:779)
	at
org.apache.axis.message.MessageElement.getAsString(MessageElement.java:702)
	at
org.apache.axis.message.MessageElement.toString(MessageElement.java:830)
	at
com.ibm.sm.navy.webservices.client.ClientStockCheck.execute(ClientStockCheck
.java:76)
	at
com.ibm.sm.navy.webservices.client.test.ClientStockCheckTest.testNIIN(Client
StockCheckTest.java:79)
	at java.lang.reflect.Method.invoke(Native Method)
	at junit.framework.TestCase.runTest(TestCase.java:154)
	at junit.framework.TestCase.runBare(TestCase.java:127)
	at junit.framework.TestResult$1.protect(TestResult.java:106)
	at junit.framework.TestResult.runProtected(TestResult.java:124)
	at junit.framework.TestResult.run(TestResult.java:109)
	at junit.framework.TestCase.run(TestCase.java:118)
	at junit.framework.TestSuite.runTest(TestSuite.java:208)
	at junit.framework.TestSuite.run(TestSuite.java:203)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRu
nner.java:329)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.
java:218)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner
.java:151)

I think it's a bug because I'm not doing anything special. Or I could be
using the example at  http://ws.apache.org/axis/faq.html#faq18 the wrong
way. Can you please confirm or provide me a sample that works?

Any help would be appreciated.

Regards,
Albert