Search the Community
Showing results for tags 'asmx'.
-
Sveiki, Velejos vispirms atvainoties par garumzimju neessamiibu, valsts kura atrodos un vieta no kuras rakstu ierobezo mani. Problema ar ko saskaros: * ir WSDL serviss no kura velos pieprasit datus par reportiem * Ir manualis ka ar vinju runat tikai caur C# un vienkarshi XML/SOAP envelope request/response piemeeri * Ir stradajosh kods no StackOverflow -> Apskatam te lai gjenereetu valid Auth un ieguutu vajadziigo "SESSION ID". Pec SO koda es pievienoju vienkarshu pieprasijumu $client->GetSystemSettings(); Kas gjeneree: <?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> <UserSessionCredentials xmlns="http://www.NSadrese.net/"> <UserId>int</UserId> <ClientId>string</ClientId> <SessionId>string</SessionId> </UserSessionCredentials> </soap:Header> <soap:Body> <GetSystemSettings xmlns="http://www.NSadrese.net/" /> </soap:Body> </soap:Envelope> Atbilde <IntegrationResponse xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.NSadrese.net/"> <ResponseId>0</ResponseId> <TotalCount>0</TotalCount> <Detail>dd/MM/yyyy HH:mm</Detail> <Statuses/> <ImportingQueueId>0</ImportingQueueId> <SalesOrdersToDespatchIds/> </IntegrationResponse> Kas pieraada ka es speeju sarunaaties ar sho WSDL servisu. Bet tiklidz es veelos piekljuut savadaakiem datiem, man vienmeer raada ka ir objekts kursh nav "atrakstiits", lasot dziljaak saprotu ka neesmu pareizi izveidojis pieprasiijumu (struktruura). Vel paseedeeju paaris dienas un sapratu ka nav lemts. Tad uzduros uz shi servisa http://www.soapclient.com/soaptest.html Kas ljauj man ievadit WSDL linku, un gjeneree HTML INPUT formas un te viss straadaa, es veeleetos sho informaaciju padot no sava WEBservera caur PHP SOAP bet dotajaa gadijumaa es laizhu visu caur file_get_contents kaa ENCODED url request uz sho formu un tad sijaaju XML responsi etc. Ludzu skatiet : Gribetu zinat ka shis Serviss uzgjeneree pareizus pieprasijumus Un vel vairaak neizprotu kadelj kad pieprasijums ir pabeigts, XML rezultats ir shads: <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <soap:Body> <GetReportDataResponse xmlns="http://www.NSadrese.net/"> <GetReportDataResult> <ResponseId>0</ResponseId> <TotalCount>1896</TotalCount> <Detail> "Total","Type" "1747","Allocated" "14","Partially allocated" "1","Partially despatched" "8","Partially picked" "126","Picked" </Detail> <Statuses/> <ImportingQueueId>0</ImportingQueueId> <SalesOrdersToDespatchIds/> </GetReportDataResult> </GetReportDataResponse> </soap:Body> </soap:Envelope> PS>Mani pa lielam interesee tikai <TotalCount> un <Detail> Pashaas beigaas sapratu ka esmu lops un vajadzeetu saprast ka lietot CLASS / un CLASSMAP, bet Tad izmantojot http://www.stccorp.net/ewsdl2php/wsdl2php.php Ieguvu sho : <?php class Authenticate{ var $clientId;//string var $username;//string var $password;//string } class AuthenticateResponse{ var $AuthenticateResult;//IntegrationResponse } class IntegrationResponse{ var $ResponseId;//int var $TotalCount;//int var $Detail;//string var $Statuses;//ArrayOfIntegrationStatusResponse var $ImportingQueueId;//int var $SalesOrdersToDespatchIds;//ArrayOfInt } class ArrayOfIntegrationStatusResponse{ var $IntegrationStatusResponse;//IntegrationStatusResponse } class IntegrationStatusResponse{ var $Reference;//string var $Status;//IntegrationResponseStatuses var $LineNo;//int var $Details;//string } class ArrayOfInt{ var $int;//int } class GetData{ var $getRequest;//GetRequest } class GetRequest{ var $TemplateName;//string var $PageNo;//int var $ItemsPerPage;//int var $SearchClause;//string } class GetDataResponse{ var $GetDataResult;//IntegrationResponse } class UserSessionCredentials{ var $UserId;//int var $ClientId;//string var $SessionId;//string } class GetSystemSettings{ } class GetSystemSettingsResponse{ var $GetSystemSettingsResult;//IntegrationResponse } class GetReportData{ var $getReportRequest;//GetReportRequest } class GetReportRequest{ var $FilterClause;//string var $OrderBy;//string var $Columns;//string } class GetReportDataResponse{ var $GetReportDataResult;//IntegrationResponse } class GetReportColumns{ var $templateName;//string } class GetReportColumnsResponse{ var $GetReportColumnsResult;//IntegrationResponse } class GetSaveTemplate{ var $templateName;//string } class GetSaveTemplateResponse{ var $GetSaveTemplateResult;//IntegrationResponse } class SaveData{ var $saveRequest;//SaveRequest } class SaveRequest{ var $TemplateName;//string var $CsvData;//string var $Action;//int } class SaveDataResponse{ var $SaveDataResult;//IntegrationResponse } class SubscribeEvent{ var $eventType;//SubscriptionEventTypes var $filter;//string var $callbackUrl;//string } class SubscribeEventResponse{ var $SubscribeEventResult;//IntegrationResponse } class SubscribeEventWithSitesFilters{ var $eventType;//SubscriptionEventTypes var $filter;//string var $sitesFilter;//string var $callbackUrl;//string } class SubscribeEventWithSitesFiltersResponse{ var $SubscribeEventWithSitesFiltersResult;//IntegrationResponse } class SubscribePostEvent{ var $eventType;//SubscriptionEventTypes var $filter;//string var $postUrl;//string var $postParams;//string } class SubscribePostEventResponse{ var $SubscribePostEventResult;//IntegrationResponse } class UnsubscribeEvent{ var $subscriptionId;//int } class UnsubscribeEventResponse{ var $UnsubscribeEventResult;//IntegrationResponse } class Range { var $soapClient; private static $classmap = array('Authenticate'=>'Authenticate' ,'AuthenticateResponse'=>'AuthenticateResponse' ,'IntegrationResponse'=>'IntegrationResponse' ,'ArrayOfIntegrationStatusResponse'=>'ArrayOfIntegrationStatusResponse' ,'IntegrationStatusResponse'=>'IntegrationStatusResponse' ,'ArrayOfInt'=>'ArrayOfInt' ,'GetData'=>'GetData' ,'GetRequest'=>'GetRequest' ,'GetDataResponse'=>'GetDataResponse' ,'UserSessionCredentials'=>'UserSessionCredentials' ,'GetSystemSettings'=>'GetSystemSettings' ,'GetSystemSettingsResponse'=>'GetSystemSettingsResponse' ,'GetReportData'=>'GetReportData' ,'GetReportRequest'=>'GetReportRequest' ,'GetReportDataResponse'=>'GetReportDataResponse' ,'GetReportColumns'=>'GetReportColumns' ,'GetReportColumnsResponse'=>'GetReportColumnsResponse' ,'GetSaveTemplate'=>'GetSaveTemplate' ,'GetSaveTemplateResponse'=>'GetSaveTemplateResponse' ,'SaveData'=>'SaveData' ,'SaveRequest'=>'SaveRequest' ,'SaveDataResponse'=>'SaveDataResponse' ,'SubscribeEvent'=>'SubscribeEvent' ,'SubscribeEventResponse'=>'SubscribeEventResponse' ,'SubscribeEventWithSitesFilters'=>'SubscribeEventWithSitesFilters' ,'SubscribeEventWithSitesFiltersResponse'=>'SubscribeEventWithSitesFiltersResponse' ,'SubscribePostEvent'=>'SubscribePostEvent' ,'SubscribePostEventResponse'=>'SubscribePostEventResponse' ,'UnsubscribeEvent'=>'UnsubscribeEvent' ,'UnsubscribeEventResponse'=>'UnsubscribeEventResponse' ); function __construct($url='integrationservicev4.asmx?WSDL') { $this->soapClient = new SoapClient($url,array("classmap"=>self::$classmap,"trace" => true,"exceptions" => true)); } function Authenticate(Authenticate $Authenticate) { $AuthenticateResponse = $this->soapClient->Authenticate($Authenticate); return $AuthenticateResponse; } function GetData(GetData $GetData) { $GetDataResponse = $this->soapClient->GetData($GetData); return $GetDataResponse; } function GetSystemSettings(GetSystemSettings $GetSystemSettings) { $GetSystemSettingsResponse = $this->soapClient->GetSystemSettings($GetSystemSettings); return $GetSystemSettingsResponse; } function GetReportData(GetReportData $GetReportData) { $GetReportDataResponse = $this->soapClient->GetReportData($GetReportData); return $GetReportDataResponse; } function GetReportColumns(GetReportColumns $GetReportColumns) { $GetReportColumnsResponse = $this->soapClient->GetReportColumns($GetReportColumns); return $GetReportColumnsResponse; } function GetSaveTemplate(GetSaveTemplate $GetSaveTemplate) { $GetSaveTemplateResponse = $this->soapClient->GetSaveTemplate($GetSaveTemplate); return $GetSaveTemplateResponse; } function SaveData(SaveData $SaveData) { $SaveDataResponse = $this->soapClient->SaveData($SaveData); return $SaveDataResponse; } function SubscribeEvent(SubscribeEvent $SubscribeEvent) { $SubscribeEventResponse = $this->soapClient->SubscribeEvent($SubscribeEvent); return $SubscribeEventResponse; } function SubscribeEventWithSitesFilters(SubscribeEventWithSitesFilters $SubscribeEventWithSitesFilters) { $SubscribeEventWithSitesFiltersResponse = $this->soapClient->SubscribeEventWithSitesFilters($SubscribeEventWithSitesFilters); return $SubscribeEventWithSitesFiltersResponse; } function SubscribePostEvent(SubscribePostEvent $SubscribePostEvent) { $SubscribePostEventResponse = $this->soapClient->SubscribePostEvent($SubscribePostEvent); return $SubscribePostEventResponse; } function UnsubscribeEvent(UnsubscribeEvent $UnsubscribeEvent) { $UnsubscribeEventResponse = $this->soapClient->UnsubscribeEvent($UnsubscribeEvent); return $UnsubscribeEventResponse; } function Authenticate(Authenticate $Authenticate) { $AuthenticateResponse = $this->soapClient->Authenticate($Authenticate); return $AuthenticateResponse; } function GetData(GetData $GetData) { $GetDataResponse = $this->soapClient->GetData($GetData); return $GetDataResponse; } function GetSystemSettings(GetSystemSettings $GetSystemSettings) { $GetSystemSettingsResponse = $this->soapClient->GetSystemSettings($GetSystemSettings); return $GetSystemSettingsResponse; } function GetReportData(GetReportData $GetReportData) { $GetReportDataResponse = $this->soapClient->GetReportData($GetReportData); return $GetReportDataResponse; } function GetReportColumns(GetReportColumns $GetReportColumns) { $GetReportColumnsResponse = $this->soapClient->GetReportColumns($GetReportColumns); return $GetReportColumnsResponse; } function GetSaveTemplate(GetSaveTemplate $GetSaveTemplate) { $GetSaveTemplateResponse = $this->soapClient->GetSaveTemplate($GetSaveTemplate); return $GetSaveTemplateResponse; } function SaveData(SaveData $SaveData) { $SaveDataResponse = $this->soapClient->SaveData($SaveData); return $SaveDataResponse; } function SubscribeEvent(SubscribeEvent $SubscribeEvent) { $SubscribeEventResponse = $this->soapClient->SubscribeEvent($SubscribeEvent); return $SubscribeEventResponse; } function SubscribeEventWithSitesFilters(SubscribeEventWithSitesFilters $SubscribeEventWithSitesFilters) { $SubscribeEventWithSitesFiltersResponse = $this->soapClient->SubscribeEventWithSitesFilters($SubscribeEventWithSitesFilters); return $SubscribeEventWithSitesFiltersResponse; } function SubscribePostEvent(SubscribePostEvent $SubscribePostEvent) { $SubscribePostEventResponse = $this->soapClient->SubscribePostEvent($SubscribePostEvent); return $SubscribePostEventResponse; } function UnsubscribeEvent(UnsubscribeEvent $UnsubscribeEvent) { $UnsubscribeEventResponse = $this->soapClient->UnsubscribeEvent($UnsubscribeEvent); return $UnsubscribeEventResponse; }} ?> -- Vai kaads butu spejigs mani apgaismot ka izmantot/lietot sho gjenereeto PHP failu lai iegutu sev velamos rezultatus -> GetReportData ? Atvainojos varbut par nelogjiskumu/valodu esmu gandriz jau zaudejis praatu un nespeeju atrast resursus kas man speetu palidzeet. -- EDIT--- Ja kaads veelas atbildeet uz sho jautaajumu SO - luudzu : http://stackoverflow.com/questions/43340131/using-easy-php2wsdl-generated-php-code