QuickBooks WebConnector authentication fails: “unexpected element (uri:â€â€œ, local:â€strUserName“)â€
Web Technologies
Web Development
2 years ago
5
Star Rating
1
Rating
_x000D_
_x000D_
I'm trying to integrate a Java web application running under JBoss with QuickBooks Desktop and I'm using WebConnector for this purpose.
I also use JAX-WS for web service implementation in Java.
After a number of solved issues I have faced the one I've stuck: namely while WebConnector is trying to call authenticate method, JBoss throws the following exception:
[SOAPFaultHelperJAXWS] SOAP request exception
javax.xml.ws.WebServiceException: javax.xml.bind.UnmarshalException:
unexpected element (uri:"", local:"strUserName"). Expected elements are <{http://developer.intuit.com/}strPassword>,<{http://developer.intuit.com/}strUserName>
and
[SOAPFaultHelperJAXWS] SOAP request exception
javax.xml.ws.WebServiceException: javax.xml.bind.UnmarshalException:
unexpected element (uri:"", local:"strVersion"). Expected elements are <{http://developer.intuit.com/}strVersion>
Interface:
@WebService(name = "QBWebConnectorService", targetNamespace = "http://developer.intuit.com/")
public interface QBWebConnectorService {
@WebMethod
public String serverVersion(
@WebParam(name = "strVersion", targetNamespace = "http://developer.intuit.com/")
String strVersion);
@WebMethod
public String clientVersion(
@WebParam(name = "strVersion", targetNamespace = "http://developer.intuit.com/")
String strVersion);
@WebMethod
public ArrayOfString authenticate(
@WebParam(name = "strUserName", targetNamespace = "http://developer.intuit.com/")
String strUserName,
@WebParam(name = "strPassword", targetNamespace = "http://developer.intuit.com/")
String strPassword);
...
}
Implementation:
@WebService(serviceName = "QBWebConnectorService", targetNamespace = "http://developer.intuit.com/", portName = "QBWebConnector", name = "QBWebConnector", endpointInterface = "com.example.myapp.ws.QBWebConnectorService")
public class QBWebConnector implements QBWebConnectorService {
@Override
public ArrayOfString authenticate(String strUserName, String strPassword) {
ArrayOfString arr = new ArrayOfString();
arr.string = new ArrayList();
arr.string.add("{57F3B8B1-86F1-4fcc-B1EE-566DE1813D20}");
arr.string.add(""); //To use the currently open company, specify an empty string
return arr;
}
...
}
Calls to serverVersion() and clientVersion() are executed as expected with no errors. And call to authenticate() has this issue with the namespace. But I just can't figure out why.
Can anybody provide some ideas? Thanks...
Posted on 16 Aug 2022, this text provides information on Web Development related to Web Technologies. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.
Take Quiz To Earn Credits!
Turn Your Knowledge into Earnings.