Problems using SOAP API from Java

(imported topic written by bsheward91)

Hi,

I’m trying to run a Relevance query from Java via the SOAP interface.

The problem that I am seeing is easiest demonstrated using a tool called SOAP UI (http://www.soapui.org/). If I start SOAP UI and input the URL of the WSDL, it creates an example request. The request looks like:

<soapenv:Envelope xmlns:soapenv=
"http://schemas.xmlsoap.org/soap/envelope/" xmlns:web=
"http://bigfix:80/webreports?wsdl"> <soapenv:Header/> <soapenv:Body> <web:GetRelevanceResult> <web:relevanceExpr>?</web:relevanceExpr> <web:username>?</web:username> <web:password>?</web:password> </web:GetRelevanceResult> </soapenv:Body> </soapenv:Envelope>

If I enter a valid relevance expression, username and password, and submit the request, I get back an HTML document:

<!DOCTYPE HTML PUBLIC 
"-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><title>Login - Web Reports</title><link rel=
"stylesheet" href=
"/css/besreports/ENU/layout.css" type=
"text/css"> <link rel=
"stylesheet" href=
"/css/besreports/ENU/reports.css" type=
"text/css"> <SCRIPT language=
"JavaScript" type=
"text/javascript" ><!-- function setFocus( objID ) 
{ obj = document.getElementById( objID ); 

if ( obj ) 
{ obj.focus(); 
} 
} 
//--> </SCRIPT></head><body onload=
"setFocus( 'UsernameID' )" ><div id=
"wr_header"><div id=
"wr_headertitle"></div></div><div id=
"wr_mainpage"><div id=
"wr_content" style=
"left: -170"><h2>Login</h2> <form method=
"POST" action=
"/webreports"  name=
"LoginForm"> <input type=hidden name=
"page" value=
"LoggingIn"><input type=hidden name=
"fwdpage" value=
"">Please enter your username and password to connect to Web Reports.<table> <tr><td>Username:</td><td><input type=text name=
"Username" size=
"20" value=
"" id=
"UsernameID"></td></tr> <tr><td>Password:</td><td><input type=password name=
"Password" size=
"20" value=
"" id=
"Password"></td></tr> </table> <input type=submit value=
"Login"></form> </div></div></body></html>

The weird thing, it that the URL for both the web interface and the SOAP interface both seems to be http://bigfix:80/webreports

I have tried using JBossWS 3.0.1 and it also consumes the WSDL, and appears to work flawlessly, until it complains that “text/html” is an invalid content type, suggesting that it too is getting the login page back.

Can anyone help me with this issue?

Thanks and Regards,

Barry

(imported comment written by bsheward91)

OK, I think I figured out the problem! If the SOAP request includes

<?xml version=
"1.0" encoding=
"UTF-8" ?>

Then it gets processed as a SOAP message.