1

この Web サイトでソリューションとして言及されているのを見て、先週、expresso paser (www.sxml.com.au) を使い始めました。無料のアカウントを作成してログインし、XML ファイルをアップロードしてファイルを解析しました。画面で結果を確認できました。次に、Java でクライアント コードを生成し、それを実行しました。

HTTP を使用して非 SSL バージョンを実行していたところ、SXML サーバーからこのエラーが返されました。

他の誰かがこれを経験していますか?

これをできるだけ早くプロジェクトに統合する必要があるので、助けてください!!

これは、SXML サーバーに接続して要求を行うクライアント コードの一部です。

String username = "adamCoyle";
String password = ""; //ADD PASSWORD HERE
String connectionName = "test1";
String company = "student";
String remoteSXMLURL="http://sxml.com.au:8080/Expresso/RemoteSXML";
/*
 * Non- SSL mode
 */
/*
* For SSL mode, uncomment the following code and follow certificate installation     instructions in help section
* of website to install the SSL cert into the CA keystore
*/
//String remoteSXMLURL="https://sxml.com.au:8444/Expresso/RemoteSXML";

String urlParams ="";

String fileLocation = "server";

String fileForXMLUpload = "";

if(fileForXMLUpload!="")

{

File xmlFileToBeUploadedFile = new File (fileForXMLUpload);

fileForXMLUpload="";

if(xmlFileToBeUploadedFile.exists())

{

BufferedReader bfr = new BufferedReader(new FileReader (xmlFileToBeUploadedFile));

while(bfr.ready())

{

fileForXMLUpload+=bfr.readLine();

}

}

}

String mode= "all";

String isCached = "false";

String areRulesSimple ="false";

String dynamicParamaters ="";

String sortBy ="";

/* step 2 - make a https connection */

URL sxml = new URL(remoteSXMLURL);

HttpURLConnection yc = (HttpURLConnection) sxml.openConnection();

/* step 3- add the paramaters to the HTTPS connection */

String urlParameters = "username="

+ URLEncoder.encode(username, "UTF-8") + "&password="

+ URLEncoder.encode(password, "UTF-8") + "&connectionName="

+ URLEncoder.encode(connectionName, "UTF-8") + "&company="

+ URLEncoder.encode(company, "UTF-8") + "&fileLocation="

+ URLEncoder.encode(fileLocation, "UTF-8") + "&fileForXMLUpload="

+ URLEncoder.encode(fileForXMLUpload, "UTF-8") + "&mode="

+ URLEncoder.encode(mode, "UTF-8") + "&isCached="

+ URLEncoder.encode(isCached, "UTF-8") + "&areRulesSimple="

+ URLEncoder.encode(areRulesSimple, "UTF-8") + "&dynamicParamaters="

+ URLEncoder.encode(dynamicParamaters, "UTF-8") + "& urlParams ="

+ URLEncoder.encode(urlParams, "UTF-8") + "&sortBy="

+ URLEncoder.encode(sortBy, "UTF-8");

/* step 4- set the properties for the HTTPS connection */

/*

* properties

* requestMethod - The HTTPS request will always be a POST request

* Content-Type - The content type is application/x-www-form-urlencoded

* content-Length - This is the length of the paramaters

*

*/

yc.setRequestMethod("POST");

yc.setRequestProperty("Content-Type","application/x-www-form-urlencoded");

yc.setRequestProperty("Content-Length","" + Integer.toString(urlParameters.getBytes().length));

yc.setRequestProperty("Content-Language", "en-US");

yc.setDoOutput(true);

/* step 5 - push out request to HTTPS server */

DataOutputStream wr = new DataOutputStream(yc.getOutputStream());

wr.writeBytes(urlParameters);

wr.flush();

wr.close();
4

1 に答える 1

1

まず、SXMLをご利用いただきありがとうございます。私たちは、できるだけ多くの開発者にそれを使用してもらうことを本当に推進しています。

クライアントコードを調べましたが、フィールドがありません。Expresso XMLパーサーを使用するには、パスワードを指定する必要があります。これは、GUIアカウントへのログインに使用したものと同じパスワードです。セキュリティ上の理由から、パスワードはクライアントコードに自動的に追加されませんが、接続するにはパスワードが必要です。

コードの中で次のような部分を見つけます

文字列パスワード=""; //ここにパスワードを追加

空白の文字列の代わりにパスワードを追加して、接続を再試行してください。接続できるはずです。

他にご不明な点がございましたら、お気軽にお問い合わせください。

Laura Cavanagh www.sxml.com.au

于 2012-10-29T11:00:01.977 に答える