Webservice SOAP request - Wrong type of data sent

前端 未结 1 773
甜味超标
甜味超标 2020-12-22 06:53

Context / What I want :

I\'m facing an issue while calling a Webservice with SOAP. Here\'s an image the relevant part of the WS I want to call : <

1条回答
  •  Happy的楠姐
    2020-12-22 07:42

    At your WSDL's type, there's a sequence named Demande_de_mot_de_passe which use a element named Demande_de_mot_de_passeRequest and not Demande_de_mot_de_passe_Input.

    Your print from SoapUI describe the message request, but if it's document style, Demande_de_mot_de_passe is a type. On the other hand if it's RPC is the method name.

    Starting if it's RPC you can do as showed below. You should use as native object as you can (SOAP will work better with they). A stdObject will be good enough:

    $request = new stdClass();
    
    $demande_de_mot_de_passeRequest->Code_societe = '000';
    $demande_de_mot_de_passeRequest->Ident_type = 'A';
    $demande_de_mot_de_passeRequest->Ident_code = 'xxxxxx';
    $demande_de_mot_de_passeRequest->Dat_demande = '00000000';
    $demande_de_mot_de_passeRequest->Adr_mail = 'xxxxxx';
    $demande_de_mot_de_passeRequest->Adr_cpos = 'xxxxxx';
    $demande_de_mot_de_passeRequest->Nom = 'xxxxxx';
    $demande_de_mot_de_passeRequest->Prenom = 'xxxxxx';
    $demande_de_mot_de_passeRequest->Dat_naiss = '00000000';
    
    $request->Demande_de_mot_de_passeRequest = $demande_de_mot_de_passeRequest;
    
    $response = $client->Demande_de_mot_de_passe($request);
    

    If your SOAP binding is document, you just have to add a new upper level named Demande_de_mot_de_passe

    /** The variable $demande_de_mot_de_passeRequest is created as above **/
    
    $demande_de_mot_de_passe = new stdClass();
    $demande_de_mot_de_passe->Demande_de_mot_de_passeRequest = $demande_de_mot_de_passeRequest;
    $request->Demande_de_mot_de_passe = $demande_de_mot_de_passe;
    
    $response = $client->Demande_de_mot_de_passe($request);
    

    Your WSDL doesn't need a list/collections (it's not your case), so you don't need to create/parse variables with SoapVar. There's others examples that you can read about (one is mine, but it's in portuguese) and other is about the BOGUS node:

    http://forum.imasters.com.br/topic/535213-enviar-xml-via-soap/?p=2137411 http://www.fischco.org/blog/2011/3/26/php-soapserver-objects-arrays-and-encoding.html

    0 讨论(0)
提交回复
热议问题