[jboss-user] [JBoss Web Services] - javax.xml.bind.UnmarshalException: unexpected element?

Joseph Hwang do-not-reply at jboss.com
Mon May 30 02:20:24 EDT 2011


Joseph Hwang [http://community.jboss.org/people/aupres] created the discussion

"javax.xml.bind.UnmarshalException: unexpected element?"

To view the discussion, visit: http://community.jboss.org/message/607678#607678

--------------------------------------------------------------
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/ http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws=" http://ws.aaa.com/ 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 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/'; http://ws.aaa.com/';
               var call = new WS.Call(' http://localhost:8080/TotalTest/WSLoginTest'); 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/ 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
[http://community.jboss.org/message/607678#607678]

Start a new discussion in JBoss Web Services at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2044]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20110530/449d804e/attachment-0001.html 


More information about the jboss-user mailing list