Jabón-¿cómo?

  • righteous_trespasser
  • Scuffle
  • Genius
  • Avatar de Usuario
  • Registrado: Mar 12, 2007
  • Mensajes: 6228
  • Loc: South-Africa
  • Status: Offline

Nota Junio 2nd, 2011, 11:22 pm

Nunca he usado PHPs SOAP a hacer nada, así que estoy seriamente familiarizado con el formato de una llamada correcta de SOAP. Solicitar la documentación en el servidor que estoy usando Estados que tengo que hacer primero un "inicio de sesión" y, a continuación, recibiré mi "símbolo" que necesito para utilizar para el resto de mis transacciones con este servidor.

Lo primera, la función de inicio de sesión; La documentación indica que la llamada debe tener el siguiente aspecto:

XML Código: [ Select ]
POST /poswebservice/V3DataAccess.asmx HTTP/1.1
Host: <!-- m --><span class="postlink">http://www.ticketbreak.co.za</span><!-- m -->
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://www.ticketbreak.com/poswebservice/V3DataAccess.asmx/Login"
 
<?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:Body>
    <Login xmlns="http://www.ticketbreak.com/poswebservice/V3DataAccess.asmx">
      <UserName>string</UserName>
      <Password>string</Password>
    </Login>
  </soap:Body>
</soap:Envelope>
  1. POST /poswebservice/V3DataAccess.asmx HTTP/1.1
  2. Host: <!-- m --><span class="postlink">http://www.ticketbreak.co.za</span><!-- m -->
  3. Content-Type: text/xml; charset=utf-8
  4. Content-Length: length
  5. SOAPAction: "http://www.ticketbreak.com/poswebservice/V3DataAccess.asmx/Login"
  6.  
  7. <?xml version="1.0" encoding="utf-8"?>
  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/">
  9.   <soap:Body>
  10.     <Login xmlns="http://www.ticketbreak.com/poswebservice/V3DataAccess.asmx">
  11.       <UserName>string</UserName>
  12.       <Password>string</Password>
  13.     </Login>
  14.   </soap:Body>
  15. </soap:Envelope>


WSDL para esta función es como sigue:

XML Código: [ Select ]
<s:element name="Login">
 <s:complexType>
  <s:sequence>
   <s:element minOccurs="0" maxOccurs="1" name="UserName" type="s:string"/>
   <s:element minOccurs="0" maxOccurs="1" name="Password" type="s:string"/>
  </s:sequence>
 </s:complexType>
</s:element>
<s:element name="LoginResponse">
 <s:complexType>
  <s:sequence>
   <s:element minOccurs="0" maxOccurs="1" name="LoginResult">
    <s:complexType>
     <s:sequence>
      <s:any minOccurs="0" maxOccurs="unbounded" namespace="http://www.w3.org/2001/XMLSchema" processContents="lax"/>
      <s:any minOccurs="1" namespace="urn:schemas-microsoft-com:xml-diffgram-v1" processContents="lax"/>
     </s:sequence>
     <s:attribute fixed="http://www.ticketbreak.com/Accounts.xsd" name="namespace"/>
     <s:attribute fixed="AccountsDataTable" name="tableTypeName"/>
    </s:complexType>
   </s:element>
  </s:sequence>
 </s:complexType>
</s:element>
  1. <s:element name="Login">
  2.  <s:complexType>
  3.   <s:sequence>
  4.    <s:element minOccurs="0" maxOccurs="1" name="UserName" type="s:string"/>
  5.    <s:element minOccurs="0" maxOccurs="1" name="Password" type="s:string"/>
  6.   </s:sequence>
  7.  </s:complexType>
  8. </s:element>
  9. <s:element name="LoginResponse">
  10.  <s:complexType>
  11.   <s:sequence>
  12.    <s:element minOccurs="0" maxOccurs="1" name="LoginResult">
  13.     <s:complexType>
  14.      <s:sequence>
  15.       <s:any minOccurs="0" maxOccurs="unbounded" namespace="http://www.w3.org/2001/XMLSchema" processContents="lax"/>
  16.       <s:any minOccurs="1" namespace="urn:schemas-microsoft-com:xml-diffgram-v1" processContents="lax"/>
  17.      </s:sequence>
  18.      <s:attribute fixed="http://www.ticketbreak.com/Accounts.xsd" name="namespace"/>
  19.      <s:attribute fixed="AccountsDataTable" name="tableTypeName"/>
  20.     </s:complexType>
  21.    </s:element>
  22.   </s:sequence>
  23.  </s:complexType>
  24. </s:element>


Llama a la función de inicio de sesión con éxito con el siguiente código:

PHP Código: [ Select ]
$client = new SoapClient('http://www.ticketbreak.co.za/poswebservice/V3DataAccess.asmx?WSDL');
  $result = $client->login(
    array(
      'UserName' => 'username@email.extension',
      'Password' => 'password'
    )
  );
  $temp_return = $result->LoginResult->any;
  $end_stripping = strpos($temp_return,'</xs:schema>')+12;
  $temp_return = substr($temp_return,$end_stripping,(strlen($temp_return) - $end_stripping));
  $xml = simplexml_load_string($temp_return);
  $token = $xml->DocumentElement->Accounts->AuthUserID;
  1. $client = new SoapClient('http://www.ticketbreak.co.za/poswebservice/V3DataAccess.asmx?WSDL');
  2.   $result = $client->login(
  3.     array(
  4.       'UserName' => 'username@email.extension',
  5.       'Password' => 'password'
  6.     )
  7.   );
  8.   $temp_return = $result->LoginResult->any;
  9.   $end_stripping = strpos($temp_return,'</xs:schema>')+12;
  10.   $temp_return = substr($temp_return,$end_stripping,(strlen($temp_return) - $end_stripping));
  11.   $xml = simplexml_load_string($temp_return);
  12.   $token = $xml->DocumentElement->Accounts->AuthUserID;


La siguiente función, a continuación, tengo que llamar es GetEventInformation y es donde tengo problemas, la documentación indica que la llamada debe ser similar al siguiente:

XML Código: [ Select ]
POST /poswebservice/V3DataAccess.asmx HTTP/1.1
Host: <!-- m --><span class="postlink">http://www.ticketbreak.co.za</span><!-- m -->
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://www.ticketbreak.com/poswebservice/V3DataAccess.asmx/GetEventInformation"
 
<?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:Body>
    <GetEventInformation xmlns="http://www.ticketbreak.com/poswebservice/V3DataAccess.asmx">
      <Token>
        <UserName>string</UserName>
        <Token>string</Token>
      </Token>
      <EventID>int</EventID>
    </GetEventInformation>
  </soap:Body>
</soap:Envelope>
  1. POST /poswebservice/V3DataAccess.asmx HTTP/1.1
  2. Host: <!-- m --><span class="postlink">http://www.ticketbreak.co.za</span><!-- m -->
  3. Content-Type: text/xml; charset=utf-8
  4. Content-Length: length
  5. SOAPAction: "http://www.ticketbreak.com/poswebservice/V3DataAccess.asmx/GetEventInformation"
  6.  
  7. <?xml version="1.0" encoding="utf-8"?>
  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/">
  9.   <soap:Body>
  10.     <GetEventInformation xmlns="http://www.ticketbreak.com/poswebservice/V3DataAccess.asmx">
  11.       <Token>
  12.         <UserName>string</UserName>
  13.         <Token>string</Token>
  14.       </Token>
  15.       <EventID>int</EventID>
  16.     </GetEventInformation>
  17.   </soap:Body>
  18. </soap:Envelope>


El WSDL en esta función es como sigue:

XML Código: [ Select ]
<s:element name="GetEventInformation">
 <s:complexType>
  <s:sequence>
   <s:element minOccurs="1" maxOccurs="1" name="Token" type="tns:SecurityToken"/>
   <s:element minOccurs="1" maxOccurs="1" name="EventID" type="s:int"/>
  </s:sequence>
 </s:complexType>
</s:element>
<s:element name="GetEventInformationResponse">
 <s:complexType>
  <s:sequence>
   <s:element minOccurs="0" maxOccurs="1" name="GetEventInformationResult">
    <s:complexType>
     <s:sequence>
      <s:any minOccurs="0" maxOccurs="unbounded" namespace="http://www.w3.org/2001/XMLSchema" processContents="lax"/>
      <s:any minOccurs="1" namespace="urn:schemas-microsoft-com:xml-diffgram-v1" processContents="lax"/>
     </s:sequence>
     <s:attribute fixed="http://www.ticketbreak.com/Events.xsd" name="namespace"/>
     <s:attribute fixed="EventsDataTable" name="tableTypeName"/>
    </s:complexType>
   </s:element>
  </s:sequence>
 </s:complexType>
</s:element>
  1. <s:element name="GetEventInformation">
  2.  <s:complexType>
  3.   <s:sequence>
  4.    <s:element minOccurs="1" maxOccurs="1" name="Token" type="tns:SecurityToken"/>
  5.    <s:element minOccurs="1" maxOccurs="1" name="EventID" type="s:int"/>
  6.   </s:sequence>
  7.  </s:complexType>
  8. </s:element>
  9. <s:element name="GetEventInformationResponse">
  10.  <s:complexType>
  11.   <s:sequence>
  12.    <s:element minOccurs="0" maxOccurs="1" name="GetEventInformationResult">
  13.     <s:complexType>
  14.      <s:sequence>
  15.       <s:any minOccurs="0" maxOccurs="unbounded" namespace="http://www.w3.org/2001/XMLSchema" processContents="lax"/>
  16.       <s:any minOccurs="1" namespace="urn:schemas-microsoft-com:xml-diffgram-v1" processContents="lax"/>
  17.      </s:sequence>
  18.      <s:attribute fixed="http://www.ticketbreak.com/Events.xsd" name="namespace"/>
  19.      <s:attribute fixed="EventsDataTable" name="tableTypeName"/>
  20.     </s:complexType>
  21.    </s:element>
  22.   </s:sequence>
  23.  </s:complexType>
  24. </s:element>


Actualmente estoy utilizando el código siguiente:

PHP Código: [ Select ]
$result_tickets = $client->GetEventInformation(
    array(
      'Token' => array(
        'Username' => 'username@email.extension',
        'Token' => $token
      ),
      'EventID' => 1140
    )
  );
echo '<pre>',print_r($result_tickets),'</pre><br /><br />';
  1. $result_tickets = $client->GetEventInformation(
  2.     array(
  3.       'Token' => array(
  4.         'Username' => 'username@email.extension',
  5.         'Token' => $token
  6.       ),
  7.       'EventID' => 1140
  8.     )
  9.   );
  10. echo '<pre>',print_r($result_tickets),'</pre><br /><br />';


Pero todo este código devuelve un objeto vacío:

Código: [ Select ]
stdClass Object
(
)
1
  1. stdClass Object
  2. (
  3. )
  4. 1


¿Se siente me como el formato de la matriz que estoy enviando a la GetEventInformation no tiene el formato correcto...? O se supone que enviar los encabezados con??? ¿Y si es necesario enviar los encabezados, cómo sería que dar formato?
Let's leave all our *plum* where it is and go live in the jungle ...
  • Anonymous
  • Bot
  • No Avatar
  • Registrado: 25 Feb 2008
  • Mensajes: ?
  • Loc: Ozzuland
  • Status: Online

Nota Junio 2nd, 2011, 11:22 pm

  • righteous_trespasser
  • Scuffle
  • Genius
  • Avatar de Usuario
  • Registrado: Mar 12, 2007
  • Mensajes: 6228
  • Loc: South-Africa
  • Status: Offline

Nota Junio 3rd, 2011, 12:03 am

Wooohoo he averiguado esto, lo que un shouldve de error tonto "username" ha "username".
Let's leave all our *plum* where it is and go live in the jungle ...
  • Bogey
  • Bogey
  • Genius
  • Avatar de Usuario
  • Registrado: Jul 14, 2005
  • Mensajes: 8211
  • Loc: USA
  • Status: Offline

Nota Junio 3rd, 2011, 12:22 am

righteous_trespasser escribió:
Wooohoo...pensé que esto fuera, lo que un shouldve de error tonto "username" ha "username".

Bah! Estos errores siempre conseguirle.

Alegro tienes que trabajar
"Bring forth therefore fruits meet for repentance:" Matthew 3:8
  • spork
  • Brewmaster
  • Silver Member
  • Avatar de Usuario
  • Registrado: Sep 22, 2003
  • Mensajes: 6130
  • Loc: Seattle, WA
  • Status: Offline

Nota Junio 3rd, 2011, 10:34 am

UGH. Utilizar SOAP. Seriamente.
The Beer Monocle. Classy.
  • righteous_trespasser
  • Scuffle
  • Genius
  • Avatar de Usuario
  • Registrado: Mar 12, 2007
  • Mensajes: 6228
  • Loc: South-Africa
  • Status: Offline

Nota Junio 4th, 2011, 1:40 am

spork escribió:
UGH. Utilizar SOAP. Seriamente.

¿No tengo una opción aquí, creo que...existe una alternativa? Esto es algo nunca hecho antes por lo que en realidad no tengo ni idea de Ive...
Let's leave all our *plum* where it is and go live in the jungle ...
  • spork
  • Brewmaster
  • Silver Member
  • Avatar de Usuario
  • Registrado: Sep 22, 2003
  • Mensajes: 6130
  • Loc: Seattle, WA
  • Status: Offline

Nota Junio 6th, 2011, 12:27 pm

resto , o si se debe utilizar un marco RPC, XML-RPC es una buena alternativa para SOAP.
The Beer Monocle. Classy.
  • Rabid Dog
  • Web Master
  • Web Master
  • Avatar de Usuario
  • Registrado: May 21, 2004
  • Mensajes: 3229
  • Loc: South Africa
  • Status: Offline

Nota Junio 14th, 2011, 1:07 am

¿Ataques de SOAP son? Personalmente no tengo ningún problema con jabón. Desarrolló una gran escala SOA mediante SOAP. También he hecho los servicios sosegados y los servicios de XML-RPC. En mi opinión si desea puede nada sería XML-RPC :) todos XML-RPC se permiten pasar a través de XML. No impone nada y al desarrollo contra una tercera parte de esto puede ser peligroso a la cordura de los particullarly :) SOAP utiliza el XSD para aplicar el hecho de que su mensaje es bien con formato y es compatible con el mensaje esperado. Si realmente desea entrar en computación distribuida, a continuación, zanja el resto, SOAP y XML-RPC y examinar CORBA
Watch me grow
  • Zealous
  • Guru
  • Guru
  • Avatar de Usuario
  • Registrado: Abr 15, 2011
  • Mensajes: 1195
  • Loc: Sydney
  • Status: Offline

Nota Junio 24th, 2011, 3:44 am

¿nunca visto este jabón aparte en la ducha? hhmm que ya es hora de google

Publicar Información

  • Total de mensajes en este tema: 8 mensajes
  • Usuarios navegando por este Foro: No hay usuarios registrados visitando el Foro y 141 invitados
  • No puede abrir nuevos temas en este Foro
  • No puede responder a temas en este Foro
  • No puede editar sus mensajes en este Foro
  • No puede borrar sus mensajes en este Foro
  • No puede enviar adjuntos en este Foro
 
 

© 2011 Unmelted, LLC. Ozzu® es una marca registrada de Unmelted, LLC