我有以下SOAP XML,我试图通过soap标头身份验证访问车辆详细信息。我尝试了下面的代码。我认为,我在此方面缺少任何东西。你能帮忙吗
class FlipkartSpider(Spider):
name = 'flipkarttrial1'
allowed_domains = ['flipkart.com']
start_urls = ['https://www.flipkart.com/womens-footwear/heels/pr?sid=osp,iko,6q1&otracker=nmenu_sub_Women_0_Heels']
def parse(self, response):
self.driver = webdriver.Chrome('C:\xyz\chromedriver')
self.driver.get(response.url)
sel = Selector(text=self.driver.page_source)
prices = sel.xpath('//div/div[@class="_1vC4OE"]/text()').extract()
output = open('output_data.csv', 'w')
fieldnames = ['price']
csv_file = csv.DictWriter(output, fieldnames)
for price in prices:
yield csv_file.writerow({fieldnames[0]: price})
PHP代码以及SOAP Header,如下所示。
SOAPAction: "http://abcddetails.org/getVehicleDetails"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<UserIdentifierSoapHeaderIn xmlns="http://abcddetails.org/">
<UserName>string</UserName>
<Password>string</Password>
</UserIdentifierSoapHeaderIn>
</soap:Header>
<soap:Body>
<getVehicleDetails xmlns="http://abcddetails.org/">
<request>
<SystemCode>int</SystemCode>
<UserID>string</UserID>
<PlateInfo>
<PlateNo>long</PlateNo>
<PlateOrgNo>long</PlateOrgNo>
<PlateColorCode>int</PlateColorCode>
</PlateInfo>
<ChassisNo>string</ChassisNo>
</request>
</getVehicleDetails>
</soap:Body>
您能指导我在这里写错什么吗?
答案 0 :(得分:2)
您可以像这样使用$result = $client->__soapCall('webserviceMethodeName', ['parameters' => $params]);
方法:
$responce_param = $client->__soapCall('getVehicleDetails', ['parameters' => $request_param]);
在您的情况下,肥皂动作将被这样调用:
some_key_value