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 Michael <mi...@cox.net> on 2003/06/24 21:47:32 UTC

newbie: How to Setup Parms for Service

I am trying to figure out the best way to get setup parameters for my
bean based web service.  I'm using the following code in the
constructor of my bean (using JBuilder & Axis 1.1 rc2).

I'm finding that both methods work but I don't understand the
difference and if either of these or another method is more
appropriate to use.

Method #1
org.apache.axis.MessageContext msgContext =
    org.apache.axis.MessageContext.getCurrentContext();
String paramValue = (String)
   msgContext.getProperty("Name");
System.err.println("paramValue="+paramValue);

Method #2
org.apache.axis.handlers.soap.SOAPService service =
  msgContext.getService();
paramValue = (String) service.getOption("Name");
System.err.println("paramValue="+paramValue);

I also tried to put the params in <globalConfiguration> but was
unable to figure out how to retrieve the parms from there.  I'm not
sure I want that anyway but would like to know how to make that work.

Thanks in advance,
Mike




problem creating a XML namespace with a given Prefix

Posted by Kai Unewisse <ka...@innovations.de>.
Hi,
I have a problem creating a XML namespace with a given Prefix (wsu):


My Code :
  soapBody.addNamespaceDeclaration("wsu",
"http://schemas.xmlsoap.org/ws/2002/07/utility");

  PrefixedQName qname = new PrefixedQName(
"http://schemas.xmlsoap.org/ws/2002/07/utility", "Id", "wsu");
  soapBody.addAttribute(qname ,attr.item(i).getNodeValue() );

The Result :
  <soapenv:Body ns1:Id="wsse-1a2c3870-a6eb-11d7-8103-61f316cc9325"
xmlns:ns1="http://schemas.xmlsoap.org/ws/2002/07/utility">

------------------------------------------
When I use :
  soapEnvelope.addMapping(new
Mapping("http://schemas.xmlsoap.org/ws/2002/07/utility", "wsu"));

  PrefixedQName qname = new PrefixedQName(
"http://schemas.xmlsoap.org/ws/2002/07/utility", "Id", "wsu");
  soapBody.addAttribute(qname ,attr.item(i).getNodeValue() );

is the result OK:
  <soapenv:Envelope (...)
xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility">

 <soapenv:Body wsu:Id="wsse-67dabc80-a6ec-11d7-98fa-71b2b9a5154e">


Do I need additional steps to addNamespaceDeclaration(), when I want to add
a Namespace Declaration ? Is there a easier way ?

Please forgive me asking such easy questions, but I couldn't find anything
in the archive and the Bug report.


Thanks for your help,

Kai