嗨,我需要从SOAP webservice获取数据。这是一个例子:
POST /b2b.asmx HTTP/1.1
Host: webservice.presstours.it
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<TtiPackageCosting xmlns="http://webservice.presstours.it/">
<TTI_PkgCostRQ EchoToken="string" TimeStamp="dateTime" Target="" Version="decimal" TransactionIdentifier="string" SequenceNmbr="nonNegativeInteger" TransactionStatusCode="" ReqRespVersion="string" ActionType="Book or Quote or Hold or Initiate or Ignore or Modify or Commit or Cancel or CommitOverrideEdits or VerifyPrice or Ticket" xmlns="http://www.opentravel.org/OTA/2003/05">
<POS>
<Source AgentSine="string" PseudoCityCode="string" ISOCountry="string" ISOCurrency="string" AgentDutyCode="string" AirlineVendorID="string" AirportCode="string" FirstDepartPoint="string" ERSP_UserID="string" TerminalID="string">
<RequestorID xsi:nil="true" />
<Position xsi:nil="true" />
<BookingChannel xsi:nil="true" />
</Source>
<Source AgentSine="string" PseudoCityCode="string" ISOCountry="string" ISOCurrency="string" AgentDutyCode="string" AirlineVendorID="string" AirportCode="string" FirstDepartPoint="string" ERSP_UserID="string" TerminalID="string">
<RequestorID xsi:nil="true" />
<Position xsi:nil="true" />
<BookingChannel xsi:nil="true" />
</Source>
</POS>
<ProvisionalID ExpiryDateTime="string" />
<PackageRequest ID="string" Type="string" TravelCode="string" TourCode="string" BoardCode="string" PromotionCode="string" FreeChildrenQuantity="integer" BrandCode="string" ProductCode="string" AvailabilityInfo="Available or Unavailable or OnRequest or Confirmed">
<URL ShareSynchInd="" ShareMarketInd="" Type="string" DefaultInd="boolean" />
<CompanyName CompanyShortName="string" TravelSector="string" Code="string" CodeContext="string" Division="string" Department="string" />
<DateRange Start="string" Duration="string" End="string" />
<ItineraryItems>
<ItineraryItem xsi:nil="true" />
<ItineraryItem xsi:nil="true" />
</ItineraryItems>
<Extras>
<Extra xsi:nil="true" />
<Extra xsi:nil="true" />
</Extras>
</PackageRequest>
<PassengerListItems>
<PassengerListItem RPH="string" Telephone="string" TelephoneSpecified="boolean" Email="string" EmailSpecified="boolean" InsuranceRPH="string" Gender="" Nationality="string" BirthDate="date" LeadCustomerInd="boolean" Age="integer" Code="string" CodeContext="string" URI="anyURI">
<Name xsi:nil="true" />
<SpecialNeed xsi:nil="true" />
<SpecialNeed xsi:nil="true" />
<PassportInformation xsi:nil="true" />
</PassengerListItem>
<PassengerListItem RPH="string" Telephone="string" TelephoneSpecified="boolean" Email="string" EmailSpecified="boolean" InsuranceRPH="string" Gender="" Nationality="string" BirthDate="date" LeadCustomerInd="boolean" Age="integer" Code="string" CodeContext="string" URI="anyURI">
<Name xsi:nil="true" />
<SpecialNeed xsi:nil="true" />
<SpecialNeed xsi:nil="true" />
<PassportInformation xsi:nil="true" />
</PassengerListItem>
</PassengerListItems>
<Extras>
<Extra />
<Extra />
</Extras>
<TPA_Extensions>xml</TPA_Extensions>
</TTI_PkgCostRQ>
</TtiPackageCosting>
</soap12:Body>
</soap12:Envelope>
我试图使用包laravel-soap在Laravel进行此调用,但我无法提出请求。有人能告诉我一个提出请求的方法吗?实际上我使用此代码尝试结果但我得到错误&#34;服务器无法处理请求。 ---&GT;对象引用未设置为对象的实例&#34;。
function show()
{
$wrapper = new \Artisaninweb\SoapWrapper\SoapWrapper();
$service = $wrapper->add('Presstours', function ($service) {
$service->wsdl('http://webservice.presstours.it/b2b.asmx?WSDL')
->cache(WSDL_CACHE_NONE)
->trace(true);
});
$data =
[
"TTI_PkgCostRQ"=>[
"POS" => [
"Source" => [
"RequestorID" => [
"ID" => "ZZZZZZZZZZ",
"MessagePassword" => "ZZZZZZZ"
]
]
],
"PackageRequest" =>
[
"ID" => "82346255"
],
"ItineraryItems" =>
[
"ItineraryItem" =>
[
"Accommodation" =>
[
"DateRange Start" => "1/07/2011",
"Duration" => "P10N",
"End" => "11/07/2011",
"RoomProfiles" =>
[
"RoomProfile"=>
[
"RoomType" => "DBL",
"RoomTypeCode" => "DBA4",
"Quantity" => "1",
"PassengerRPHs" =>
[
"ListOfPassengerRPH" => "1 2",
]
]
],
"MealPlans" =>
[
"MealPlan Plan" => "AI",
]
]
]
],
"PassengerListItems" =>
[
"PassengerListItem" =>
[
"RPH" =>"1",
"Code" => "10",
],
"PassengerListItem" =>
[
"RPH" => "2",
"Code" => "10"
]
]
]
];
$response = $service->call('Presstours.TtiPackageCosting', $data);
return response()->json($response);
}
}
答案 0 :(得分:0)
您没有提供任何显示您如何请求SOAP服务的代码。
<ActivityIndicator
animating = {animating}
color = '#bc2b78' // color of your choice
size = "large"
style = {styles.activityIndicator}/> //add extra styling
请记住,它会根据您要求的肥皂服务以及您想要做的事情而改变。