简体   繁体   中英

SOAP: How to Make Call to CountryInfoService WSDL file in Java e.g. use CapitalCity SOAP Operation

Hi so I managed to generate WSDL Java Classes using Java-WS with the " wsimport " command. The WSDL file is from:

http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso?wsdl

在此处输入图片说明

The problem is that Im not familiar on how to use this. How do I make a SOAP call to the CapitalCity SOAP method.

In SOAPUI, you would just pass the CountryISOCode like:

xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://www.oorsprong.org/websamples.countryinfo">
   <soapenv:Header/>
   <soapenv:Body>
      <web:CapitalCity>
         <web:sCountryISOCode>UKR</web:sCountryISOCode>
      </web:CapitalCity>
   </soapenv:Body>
</soapenv:Envelope>

How to do this in Java? This is my code that I've started.

CountryInfoService countryInfoService = new CountryInfoService();

I dont know what follows next. Again Im trying to use the " CapitalCity " SOAP Operation.

Here's a sample answer:

    CountryInfoService countryInfoService = new CountryInfoService();
    CountryInfoServiceSoapType countryInfoServiceSoapType = countryInfoService.getCountryInfoServiceSoap();
    System.out.println(countryInfoServiceSoapType.capitalCity("RUS"));
    //output is 'Moscow'

That's how to use it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM