嗨,所以我设法通过“ wsimport ”命令使用Java-WS生成WSDL Java类。 WSDL文件来自:
from scrapy.linkextractors import LinkExtractor
class QuotesSpider(scrapy.Spider):
name = 'quotes'
start_urls = ['http://quotes.toscrape.com/page/1/']
def parse(self, response):
for quote in response.css('div.quote'):
yield {
'text': quote.css('span.text::text').get(),
'author': quote.css('small.author::text').get(),
'tags': quote.css('div.tags a.tag::text').getall(),
}
for a in LinkExtractor(allow_domains=['quotes.toscrape.com']).extract_links(response):
yield response.follow(a, callback=self.parse)
问题是我对如何使用它不熟悉。 如何对CapitalCity SOAP方法进行SOAP调用。
在SOAPUI中,您只需传递 CountryISOCode ,例如:
http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso?wsdl
如何用Java做到这一点? 这是我已经开始的代码。
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>
我不知道接下来会发生什么。我再次尝试使用“ CapitalCity ” SOAP操作。
答案 0 :(得分:0)
这是一个示例答案:
CountryInfoService countryInfoService = new CountryInfoService();
CountryInfoServiceSoapType countryInfoServiceSoapType = countryInfoService.getCountryInfoServiceSoap();
System.out.println(countryInfoServiceSoapType.capitalCity("RUS"));
//output is 'Moscow'
这就是使用方法。