×

Discussion Board

Results 1 to 12 of 12
  1. #1
    Registered User
    Join Date
    Feb 2010
    Posts
    7

    Question qtsoap doesn't work with ebay web service

    We write qt project to Nokia web-laboratory in Petrozavodsk. We have problem with qtsoap library:
    Subproject must work with ebay web-service
    content files:
    ebay.cpp http://paste.org/pastebin/view/15525
    ebay.h http://paste.org/pastebin/view/15526

    main.cpp:
    #include <QtCore/QCoreApplication>
    #include "ebay.h"
    int main(int argc, char *argv[])
    {
    eBayRequest *ebay = new eBayRequest();
    ebay->submitRequest();
    QCoreApplication a(argc, argv);

    return a.exec();
    }

    When project post http request to ebay, we get this XML file with error: "Transport failed: Host not found";
    We think, that header arguments, which need to ebay auth, is not connected to request.
    Help us, if you know.

    P.s. Sorry to my bad english...

  2. #2
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: qtsoap doesn't work with ebay web service

    Well, just look at your code:
    Code:
    connect(&http;, SIGNAL(responseReady()), SLOT(getResponse()));

  3. #3
    Registered User
    Join Date
    Feb 2010
    Posts
    7

    Re: qtsoap doesn't work with ebay web service

    What this? We connect http->responceReady to this->getResponce.. I think that this is all right..

  4. #4
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: qtsoap doesn't work with ebay web service

    Your code doesn't compile due to multiple C++ syntactical mistakes. You can fix them and re-post proper code.

  5. #5
    Registered User
    Join Date
    Feb 2010
    Posts
    7

    Re: qtsoap doesn't work with ebay web service

    Now I`m publicing a complete repository of this subproject. I can compline it. Most likely you can`t compile it because it needs the qtsoap libraries. You can download the project and the library. You may have change in the pro file. Thanks for supporting.

    http://ifolder.ru/16457124

  6. #6
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: qtsoap doesn't work with ebay web service

    Quote Originally Posted by freeppe View Post
    Most likely you can`t compile it because it needs the qtsoap libraries.
    That's what diff says:

    Code:
    Only in ebay-qtsoap/: debug
    diff -ru ebay-pastebin/ebay.cpp ebay-qtsoap/ebay.cpp
    --- ebay-pastebin/ebay.cpp	2010-02-17 10:51:17.000000000 +0200
    +++ ebay-qtsoap/ebay.cpp	2010-02-17 11:03:07.000000000 +0200
    @@ -1,8 +1,8 @@
     #include "ebay.h"
     
     
    -//Ebay может работать в двух режимах: sandbox и production. 
    -//В зависимости от выбора режима присваиваются ключи для пользования сервисом.
    +//Ebay ����� �������� � ���� �������: sandbox � production. 
    +//� ����������� �� ������ ������ ������������� ����� ��� ����������� ��������.
     /*#ifdef TEST_ENVIRONMENT // sandbox appid
     const QString eBayRequest::AppId = QString( "Nokiae548-91ff-45ee-a4d8-275fc7ab249" );
     #else // production appid
    @@ -10,7 +10,7 @@
     const QString eBayRequest::AppId = QString( "Nokia1f99-1b58-450d-8064-55c6ea744b2" );
     //#endif
     
    -const QString eBayRequest::Host = QString( "open.api.ebay.com" );
    +const QString eBayRequest::Host = QString( "http://open.api.ebay.com" );
     const int eBayRequest::Version = 655;
     const QString eBayRequest::RequestEncoding = QString( "SOAP" );
     const QString eBayRequest::ResponseEncoding = QString( "SOAP" );
    @@ -18,7 +18,7 @@
     eBayRequest::eBayRequest()
     {
         // Connect signals to slots. Note the submitRequest() slots.
    -    connect(&http;, SIGNAL(responseReady()), SLOT(getResponse()));
    +    connect(&http, SIGNAL(responseReady()), this, SLOT(getResponse()));
     
         // Prepare to submit request.
         http.setAction(Urn);
    @@ -35,31 +35,30 @@
     
         //Add url property to header. AppId and other...
     
    -    http.header.addValue("Host",eBayRequest::Host);
         QtSoapQName name;
         QtSoapType *temp;
     
         name = QtSoapQName("X-EBAY-API-VERSION",  QString::number( eBayRequest::Version ));
         temp = new QtSoapType(name,QtSoapType::AnyURI);
         request.addHeaderItem(temp);
    -    message->addHeaderItem(temp);
    +
         name = QtSoapQName("X-EBAY-API-APP-ID", eBayRequest::AppId);
    -    type = new QtSoapType(name,QtSoapType::AnyURI);
    -    request.addHeaderItem(type);
    +    temp = new QtSoapType(name,QtSoapType::AnyURI);
    +    request.addHeaderItem(temp);
     
         name = QtSoapQName("X-EBAY-API-SITE-ID", "0");
    -    type = new QtSoapType(name,QtSoapType::QName);
    -    request.addHeaderItem(type);
    +    temp = new QtSoapType(name,QtSoapType::QName);
    +    request.addHeaderItem(temp);
     
     
         name = QtSoapQName("X-EBAY-API-REQUEST-ENCODING", eBayRequest::RequestEncoding );
    -    type = new QtSoapType(name,QtSoapType::AnyURI);
    -    request.addHeaderItem(type);
    +    temp = new QtSoapType(name,QtSoapType::AnyURI);
    +    request.addHeaderItem(temp);
     
         name = QtSoapQName("X-EBAY-API-RESPONSE-ENCODING", eBayRequest::ResponseEncoding);
    -    type = new QtSoapType(name,QtSoapType::QName);
    -    request.addHeaderItem(type);
    -*/
    +    temp = new QtSoapType(name,QtSoapType::QName);
    +    request.addHeaderItem(temp);
    +
         //Set method of ebay
         request.setMethod(QtSoapQName("FindItems", "urn:ebay:apis:eBLBaseComponents"));
         //Set arguments
    @@ -71,9 +70,8 @@
     
     void eBayRequest::getResponse()
     {
    -    const QtSoapMessage &resp; = http.getResponse();
    +    const QtSoapMessage &resp = http.getResponse();
         printf("\nOutput\n");
         printf(resp.toXmlString().toAscii());
         return;
     }
    -
    Only in ebay-qtsoap/: ebay-qtsoap.pro
    Only in ebay-qtsoap/: ebay-qtsoap.pro.user
    Only in ebay-qtsoap/: ebayrequest.cpp
    Only in ebay-qtsoap/: ebayrequest.h
    Only in ebay-qtsoap/: Makefile
    Only in ebay-qtsoap/: Makefile.Debug
    Only in ebay-qtsoap/: Makefile.Release
    Only in ebay-qtsoap/: release

  7. #7
    Registered User
    Join Date
    Feb 2010
    Posts
    7

    Re: qtsoap doesn't work with ebay web service

    Sorry i have sended first time the false version, the second version is the better one.

  8. #8
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: qtsoap doesn't work with ebay web service

    You should not use scheme while setting the host, since the resulting QUrl you get is something like "http://http://open.api.ebay.com". Naturally, there is no such host.

  9. #9
    Registered User
    Join Date
    Feb 2010
    Posts
    7

    Re: qtsoap doesn't work with ebay web service

    If fill url as "open.api.ebay.com", then we get:

    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/1999/XMLSchema">
    <SOAP-ENV:Header xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"/>
    <SOAP-ENV:Body xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <FindItems xmlns="urn:ebay:apis:eBLBaseComponents">
    <QueryKeywords xsi:type="xsd:string" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance">n900</QueryKeywords>
    <MaxEntries xsi:type="xsd:string" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance">50</MaxEntries>
    </FindItems>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>

    Output
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/1999/XMLSchema">
    <SOAP-ENV:Body xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Fault xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <Faultcode xsi:type="xsd:string" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance">SOAP-ENV:Client</Faultcode>
    <Faultstring xsi:type="xsd:string" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance">503 Service Unavailable</Faultstring>
    <Faultcode xsi:type="xsd:string" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance">SOAP-ENV:VersionMismatch</Faultcode>
    <Faultstring xsi:type="xsd:string" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance">SOAP structure invalid</Faultstring>
    <SOAP-ENV:Faultdetail xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <extra xsi:type="xsd:string" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance">root element "html"/"html" is not envelope</extra>
    </SOAP-ENV:Faultdetail>
    </SOAP-ENV:Fault>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>

  10. #10
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: qtsoap doesn't work with ebay web service

    What is difference between these two code snipplets?
    Code:
    QtSoapQName name;
    QtSoapType *type;
     
    name = QtSoapQName("X-EBAY-API-VERSION", QString::number(eBayRequest::Version));
    type = new QtSoapType(name, QtSoapType::AnyURI);
    qDebug() << type->isValid();
    Code:
    QtSoapQName name;
    QtSoapType *type;
    
    name = QtSoapQName("X-EBAY-API-VERSION");
    type = new QtSoapSimpleType(name, QString::number(eBayRequest::Version));
    qDebug() << type->isValid();

  11. #11
    Registered User
    Join Date
    Feb 2010
    Posts
    7

    Re: qtsoap doesn't work with ebay web service

    Thank you, we have corrected this error. But alas SOAP-message response has not changed. So far, remained a mistake. If you see some other gross errors, help us to understand this. Thank you for your support.

    I post new version of code ebay.cpp:

    #include "ebay.h"


    //Ebay может работать в двух режимах: sandbox и production.
    //В зависимости от выбора режима присваиваются ключи для пользования сервисом.
    //#ifdef TEST_ENVIRONMENT // sandbox appid
    //const QString eBayRequest::AppId = QString( "Nokiae548-91ff-45ee-a4d8-275fc7ab249" );
    //#else // production appid
    const QString eBayRequest::AppId = QString( "Nokia1f99-1b58-450d-8064-55c6ea744b2" );
    //#endif

    const QString eBayRequest::Host = QString( "open.api.ebay.com" );
    const int eBayRequest::Version = 505;
    const QString eBayRequest::RequestEncoding = QString( "SOAP" );
    const QString eBayRequest::ResponseEncoding = QString( "SOAP" );
    const QString eBayRequest::Urn = QString("urn:ebay:apis:eBLBaseComponents");
    eBayRequest::eBayRequest():http(this)

    {
    // Connect signals to slots. Note the submitRequest() slots.
    connect(&http, SIGNAL(responseReady()), SLOT(getResponse()));

    // Prepare to submit request.
    http.setAction(Urn);
    http.setHost(eBayRequest::Host,80);
    }

    void eBayRequest::submitRequest()
    {

    // Generate request. Details about how to generate a proper
    // request are available from http://open.api.ebay.com/.

    QtSoapMessage request;

    //Add url property to header. AppId and other...

    QtSoapQName name;
    QtSoapType *temp;

    name = QtSoapQName("HOST");
    temp = new QtSoapSimpleType(name,eBayRequest::Host);
    request.addHeaderItem(temp);


    name = QtSoapQName("X-EBAY-API-VERSION");
    temp = new QtSoapSimpleType(name,QString::number( eBayRequest::Version ));
    request.addHeaderItem(temp);

    name = QtSoapQName("X-EBAY-API-APP-ID");
    temp = new QtSoapSimpleType(name,eBayRequest::AppId);
    request.addHeaderItem(temp);

    name = QtSoapQName("X-EBAY-API-SITE-ID");
    temp = new QtSoapSimpleType(name,"0");
    request.addHeaderItem(temp);


    name = QtSoapQName("X-EBAY-API-REQUEST-ENCODING");
    temp = new QtSoapSimpleType(name, eBayRequest::RequestEncoding );
    request.addHeaderItem(temp);

    name = QtSoapQName("X-EBAY-API-RESPONSE-ENCODING");
    temp = new QtSoapSimpleType(name, eBayRequest::ResponseEncoding);
    request.addHeaderItem(temp);

    //Set method of ebay
    request.setMethod(QtSoapQName("FindItem", eBayRequest::Urn));
    //Set arguments
    request.addMethodArgument("QueryKeywords", "", "n900");
    request.addMethodArgument("MaxEntries","","50");
    printf(request.toXmlString().toAscii());
    http.submitRequest(request, "/shopping?");
    }

    void eBayRequest::getResponse()
    {
    const QtSoapMessage &resp = http.getResponse();
    printf("\nOutput\n");
    printf("%d\n",resp.faultCode());
    printf(resp.faultDetail().toString().toAscii());
    printf(resp.faultString().toString().toAscii());
    printf(resp.toXmlString().toAscii());
    return;
    }

  12. #12
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: qtsoap doesn't work with ebay web service

    Since this question is about eBay shoping API (and this API is deprecated):
    http://developer.ebay.com/DevZone/sh...FindItems.html
    you can ask how to use shopping API properly on eBay forums:
    http://developer.ebay.com/community/forums/

Similar Threads

  1. Accessing a web service in j2me
    By gaurav.gupta in forum Mobile Java General
    Replies: 2
    Last Post: 2009-07-28, 12:17
  2. HTTP 307 Issue while Accessing Web Service in PAMP
    By Kathirvel.B in forum Mobile Web Server
    Replies: 3
    Last Post: 2009-07-09, 16:07
  3. networking illegal argument image from web service
    By jaakkie in forum Mobile Java Networking & Messaging & Security
    Replies: 5
    Last Post: 2009-02-02, 13:47
  4. [Moved] Implement S60 program connect to web service using NetBean6
    By qiuhuek in forum Mobile Java Networking & Messaging & Security
    Replies: 2
    Last Post: 2008-04-12, 19:46

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×