JBoss Community

javax.xml.bind.UnmarshalException: unexpected element?

created by Joseph Hwang in JBoss Web Services - View the full discussion

I try to connect ajax client to java web service. Request SOAP is like below

 

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.aaa.com/">

     <soapenv:Header/>

     <soapenv:Body>

          <ws:loginFunc>

          <!--Optional:-->

          <arg0>hwa5383</arg0>

          <!--Optional:-->

          <arg1>bbb</arg1>

          </ws:loginFunc>

     </soapenv:Body>

</soapenv:Envelope>

 

so, i coded ajax client. codes are

 

<%@ page language="java" contentType="text/html; charset=UTF-8"

pageEncoding="UTF-8"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

     <head>

     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

     <title>Connect AJAX to JWS</title>

     <script type="text/javascript" src="scripts/prototype.js"></script>

     <script type="text/javascript" src="scripts/ws.js"></script>

     <script type="text/javascript">

          function login(ID,Passwd) {

               var nsuri = 'http://ws.aaa.com/';

               var call = new WS.Call('http://localhost:8080/TotalTest/WSLoginTest');

               var qn_op = new WS.QName('loginFunc',nsuri);

               var qn_op_resp = new WS.QName('loginFuncResponse',nsuri);

               call.invoke_rpc(

                    qn_op,

                    new Array (

                         {name:'arg0', value: ID},

                         {name:'arg1', value: Passwd}), null,

                    function(call,envelope) {

                         document.getElementById('soap').innerHTML = arguments[2].escapeHTML();

                    }

               );

          }

     </script>

</head>

<body>

I D : <INPUT TYPE="text" name="ID" id="ID">

 

Passwd : <INPUT TYPE="password" name="passwd" id="passwd">

 

<INPUT TYPE="button" VALUE="Sign in" onclick="login(document.getElementById('ID').value, document.getElementById('passwd').value)">

 

</body>

</html>

 

But Exception occurs. The message is

 

javax.xml.bind.UnmarshalException: unexpected element (uri:"http://ws.aaa.com/", local:"arg0"). Expected elements are <{}arg1>,<{}arg0>

 

I think java script array part has some problems.But I have no idea.

I need your advice. Thanks in advance!

 

Best Reagrds

Reply to this message by going to Community

Start a new discussion in JBoss Web Services at Community