You need to configure the call to use document/literal. Axis generates
rpc/encoded by default, therefore you message is generated with an
extra "addUser" element wrapping the request.
I suggest that you use wsdl2java to generate a client stub. The
generated code will contain the code that generates the message and
sets up the call object.
Anne
On Jan 8, 2008 3:01 AM, kaloyz2 <[EMAIL PROTECTED]> wrote:
>
> Hello Everyone,
>
> I am new to using axis and everything especially calling and retrieving
> results from the web service. I have a problem when calling a web service
> that has other complex objects in it. This is the wsdl:
>
> <message name="addUserRequest">
> <part name="addUser" element="tns:AddUser" />
> </message>
>
> Another one:
>
> <xsd:element name="AddUser">
> <xsd:complexType>
> <xsd:sequence>
> <xsd:element name="user" type="tns:User" minOccurs="1"
> maxOccurs="1" />
> <xsd:element name="pin" type="xsd:string" minOccurs="1"
> maxOccurs="1" />
> </xsd:sequence>
> </xsd:complexType>
> </xsd:element>
>
> Now this is how I call the web service, I use got the jars by using the stub
> generation of java. Here is the code:
>
> Service service = new Service();
> //Object that would make the WS call
> Call call = (Call)service.createCall();
> call.setUsername(username);
> call.setPassword(password);
> call.setTargetEndpointAddress( new
> java.net.URL(WSAddUserAddress));
> QName qnAddUser=new QName(urn, "AddUser");
> call.setOperationName(qnAddUser);
> QName qnUser=new QName(urn ,"AddUser" );
> call.addParameter("addUser",qnUser, ParameterMode.IN);
>
> //call.setReturnType(qnAddUser);
> call.setReturnType(org.apache.axis.Constants.XSD_STRING);
> User user = new User();
>
>
> AddUser addUser = new AddUser();
> user.setFirstName("Justice");
> user.setLastName("League");
> user.setUserName("9111111");
> user.setSipPassword("12345");
> user.setPintoken("12345");
> addUser.setUser(user);
> addUser.setPin("12345");
>
> String ret = (String)call.invoke(new Object[]{addUser});
> String test =
> call.getMessageContext().getRequestMessage().getSOAPPartAsString();
>
> But everytime this code gets executed, this is the error:
>
>
> INFO [http-8080-Processor25] SipXManagerImpl.addUser(108) |
> ...................RemoteException
> axisFault
> faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
> faultSubcode:
> faultString: org.xml.sax.SAXException: Invalid element in
> org.sipfoundry.sipxconfig.api.AddUser - addUser
> faultActor:
> faultNode:
> faultDetail:
> {http://xml.apache.org/axis/}hostname:openpbx4
>
> rg.xml.sax.SAXException: Invalid element in
> org.sipfoundry.sipxconfig.api.AddUser - addUser
> at
> org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)
> at
> org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)
> at
> org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
> at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown
> Source)
> at
> org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown
> Source)
> at
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
> Source)
> at
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
> Source)
> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
>
>
> How someone can help. I am really stuck at this problem. Thank you to
> everyone.
>
> Carlo Fabian
> --
> View this message in context:
> http://www.nabble.com/Beginner-Question%3A-Error-When-passing-composite-objects-with-axis-tp14684448p14684448.html
> Sent from the Axis - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]