hello
thanks for your help Anne.It was very helpfull.
but i supprized because why axis documentation does not include or enough information about attribute value.
otherwise did i miss the something ?

http://ws.apache.org/axis/java/user-guide.html


thanks.


2006/4/17, Anne Thomas Manes <[EMAIL PROTECTED]>:
Yes -- that's correct.

Axis will support attributes in any unwrapped document/literal style service. It can also support attributes in wrapped document/literal and rpc/encoded services -- but only in child elements of the parameter accessor elements -- not in the parameter accessor elements themselves. In your case, you have an attribute in the accessor element (<s>), therefore your only option is to use unwrapped document literal.

Note, though, that the following SOAP message is invalid:


<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:m0="http://schemas.xmlsoap.org/soap/encoding/">
    <SOAP-ENV:Body>
        <myWSMethod>
            <s xmlAttributeParameter="12">Jhon </s>
        </myWSMethod>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

The child element of the <SOAP-ENV:Body> element (<myWSMethod>) must be namespace qualified. It should be:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Body>
        <ns0:myWSMethod xmlns:ns0="http://www.axis.com/TestWS">

            <s xmlAttributeParameter="12">Jhon </s>
        </ns0:myWSMethod>

    </SOAP-ENV:Body>
</SOAP-ENV:Envelope> 

In any case, my suggestion is that you define a schema that describes your input message, e.g.,:

<xsd:schema xmlns:xsd=" http://www.w3.org/2001/XMLSchema"
  targetNamespace="http://www.axis.com/TestWS" >
  <xsd:element name="myWSMethod">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="s" type="xsd:string"/>
        <xsd:attribute name="xmlAttributeParameter" type="xsd:int"/>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
</xsd:schema>

(You should also define your expected output message in the same schema).
Then embed this schema in a WSDL document that efines the "myWSMethod" operation. Then run WSDL2Java on this WSDL. Axis should automatically generate the appropriate Java classes and deserializers for you.


Anne


On 4/17/06, Recep Ayaz < [EMAIL PROTECTED]> wrote:
Hello
Thanks for your interesting Anne.But i am a little confused.

i have some question in my mind.
does Axis 1.3 support xml element attribute ?
if does, my SOAP message encoding style must be document/literal. does it ?

and your suggestion firstly write wsdl file and generate wsdd and class files.
am i right Anne ?


thanks.

2006/4/17, Anne Thomas Manes < [EMAIL PROTECTED]>:
You'll find the process much easier if you start by defining your WSDL -- then generate your code and WSDD from the WSDL.

Anne


On 4/17/06, Anne Thomas Manes <[EMAIL PROTECTED]> wrote:
Axis doesn't provide a default typemapping for this scenario, so you will need to define a custom typemapping.


On 4/17/06, Recep Ayaz < [EMAIL PROTECTED]> wrote:
Hi
Thanks for answer Anne.
I switch to documental/literal  then
system generate error and written at tomcat screen that :

- Please register a typemapping/beanmapping for 'WSApp.Beans.TestClass'

colud you give a more information ?

thanks.






2006/4/17, Anne Thomas Manes <[EMAIL PROTECTED] >:
Attributes in your parameter elements are not permitted when using rpc/encoed. I suggest you switch to document/literal.

Anne


On 4/17/06, Recep Ayaz <[EMAIL PROTECTED]> wrote:
Hello

I am using axis 1.3 and tomcat 4.1. I am writting some java classes for my web service (server-side).
But i have some problems with Xml attribute fields (this is my third email so i am apologize for annoyance.).

my question is how can get xml element attribute value ? Which parameters and definitions should be modified or made in wsdd file or java class?


also i am send,ng my java class, wsdd file and SOAP request xml

java.Class:

package WSApp.Beans;
public class TestWS  {
  public TestWS() {
  }
  public String myWSMethod(String s, int xmlAttributeParameter ) {
// doing something
//..................     ....
   
    return  "I got "s + " OK ";
  }
}
---------------------------------------------------------------------------------------
My wsdd file :

<deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java" xmlns:TestWS="http://www.axis.com/TestWS" xmlns:reg="http://www.soapinterop.org/Registry">
    <service name="TestWS" provider="java:RPC">
        <namespace>http://www.axis.com/TestWS</namespace>
        <parameter name="className" value="WSApp.Beans.TestWS"/>
        <parameter name="allowedMethods" value="myWSMethod"/>
     <requestFlow>
     <handler type="soapmonitor"/>
     </requestFlow>
     <responseFlow>
       <handler type="soapmonitor"/>
    </responseFlow>           
    </service>   
</deployment>
------------------------------------------------------------------------------------

my SOAP request xml message

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:m0="http://schemas.xmlsoap.org/soap/encoding/">
    <SOAP-ENV:Body>
        <myWSMethod>
            <s xmlAttributeParameter="12">Jhon </s>
        </myWSMethod>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

---------------------------------------------------------------------------------------------------------------------



my problem is how can i get value  of "xmlAttributeParameter" ?
please someone help me  i am really stuck about this.

Thanks.







Reply via email to