Skip to Content
Author's profile photo Benny Huang

Call the BYD webservice from the eclipse(JAVA).

Hi experts,
Two days ago, I want to call the BYD webservice from eclipse(JAVA), so I try it in my test system, it is OK. Now I share the experience,I would appreciate your comments.
1.Get ready the webservice in BYD system, for example, I choose the webservice “querysupplierin1”, create the Communication Scenarios and the Communication Arrangements.

2.Test the webservice in soapUI, maybe don’t need to do it, but I want to confirm the webservice is working. Using the Raw parameter and the XML parameter, it is OK when running.

3.Call the BYD webservice from the eclipse(JAVA), I using the httpClient, the code as:
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.httpclient.methods.RequestEntity;
import org.apache.commons.httpclient.methods.StringRequestEntity;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;

public class CallBYDQuerysupplier {

public String invokeRemoteFuc() {

//POST 方法,成功
String result = “no result!”;

//XML parameter
String soapRequestData = “”
+ “<soapenv:Envelope xmlns:soapenv=\”\” xmlns:glob=\”\”>”
+ ”  <soapenv:Header/>”
+ ”  <soapenv:Body>”
+ ”    <glob:SupplierByElementsQuery_sync>”
+ ”      <SupplierSelectionByElements>”
+ ”        <SelectionByInternalID>”
+ ”          <InclusionExclusionCode>I</InclusionExclusionCode>”
+ ”          <IntervalBoundaryTypeCode>3</IntervalBoundaryTypeCode>”
+ ”          <LowerBoundaryIdentifier>1000171</LowerBoundaryIdentifier>”
+ ”          <UpperBoundaryIdentifier>1000171</UpperBoundaryIdentifier>”
+ ”        </SelectionByInternalID>”
+ ”      </SupplierSelectionByElements>”
+ ”        <ProcessingConditions>”
+ ”            <QueryHitsMaximumNumberValue>10</QueryHitsMaximumNumberValue>”
+ ”            <QueryHitsUnlimitedIndicator>false</QueryHitsUnlimitedIndicator>”
+ ”        </ProcessingConditions>”
+ ”    </glob:SupplierByElementsQuery_sync>”
+ ”  </soapenv:Body>”
+ “</soapenv:Envelope>”;

InputStream is = null;

HttpClient client = new HttpClient();

//Raw parameter
PostMethod method = new PostMethod(“”);

method.setRequestHeader(“Host”, “”);

method.setRequestHeader(“Content-Type”, “text/xml; charset=utf-8”);
method.setRequestHeader(“Authorization”,”Basic X1RFU1Q6UHA4MzAyMDQ=”);
method.setRequestHeader(“Username”, “_TEST”);
method.setRequestHeader(“Password”, “******”);

RequestEntity requestEntity = new StringRequestEntity(soapRequestData);

try {


is = method.getResponseBodyAsStream();

Document document = Jsoup.parse(is,”UTF-8″,””);


} catch (Exception e) {




try {




} catch (IOException e) {




return result;


public static void main(String[] args) {
// TODO Auto-generated method stub

CallBYDQuerysupplier t = new CallBYDQuerysupplier();
String result = t.invokeRemoteFuc();

4.The result is xml file as:

Assigned Tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo Dor Alon
      Dor Alon

      Hello Benny,

      Thank you for the solution, it was very helpful!

      Dor Alon