Overview
Features
Download
Documentation
Community
Add-Ons & Services

Set HTTP Proxy for SOAP calls

Please post support and help requests here.

Set HTTP Proxy for SOAP calls

Postby weloveapps » 10 Jun 2014, 19:41

Hi,

I'm new to Poco development and want to watch HTTP SOAP calls via the charles web debugging proxy as development proceeds.

The Pizzeria sample runs fine (both as Makefile project under Linux) and in Xcode on Mac OS Mavericks.

Now I want to force the Poco SOAP lib to connect to the proxy on 127.0.0.1:8888 with the following code:

Code: Select all
  // register transport
  Poco::RemotingNG::SOAP::TransportFactory::registerFactory();// get proxy for remote object 
  Pizzeria::IPizzaDeliveryService::Ptr pPizzeria = Pizzeria::PizzaDeliveryServiceClientHelper::find("http://localhost:8080/soap/PizzaDeliveryService/ThePizzeria");
       
  //setup http proxy
  Poco::RemotingNG::Proxy::Ptr pProxy = pPizzeria.cast<Poco::RemotingNG::Proxy>();
  Poco::RemotingNG::SOAP::Transport& trans = static_cast<Poco::RemotingNG::SOAP::Transport&>(pProxy->remoting__transport());
  Poco::Net::HTTPSessionFactory& factory = trans.httpSessionFactory();
  factory.setProxy("127.0.0.1", 8888);


But it seems that the above statements have no effect. Any comments on this?

Best regards,
Martin
weloveapps
 
Posts: 2
Joined: 10 Jun 2014, 17:58

Re: Set HTTP Proxy for SOAP calls

Postby guenter » 10 Jun 2014, 21:21

You'll have to set the HTTP proxy before creating the Remoting proxy object. The httpSessionFactory() method is static, so at the beginning of the program, you can write:

Code: Select all
Poco::RemotingNG::SOAP::Transport::httpSessionFactory().setProxy("127.0.0.1", 8888);
guenter
 
Posts: 1132
Joined: 11 Jul 2006, 16:27
Location: Austria

Re: Set HTTP Proxy for SOAP calls

Postby weloveapps » 10 Jun 2014, 22:14

This worked! Many thanks on this!
weloveapps
 
Posts: 2
Joined: 10 Jun 2014, 17:58


Return to Support

Who is online

Users browsing this forum: No registered users and 2 guests