soap header between c#.net client and php server - soapheader

i have a web service written in php, i added it as web reference to my asp.net web site (asp,c#)
i knew how to call web service's method from c#.net client,
but the problem i still have: i want to send a soap header with web service call (from c#.net client to php server)
i did this but in php client, by using $client->setHeaders, and parsed the sending header in $server,
but how to do it in c#.net client,
note: i don't have a header class in server.php , ant it works fine with php
please help

Use WCF custom headers to fill in extra information to pass along to php.
http://cisforcoder.wordpress.com/2010/12/01/how-to-implement-basic-http-authentication-in-wcf-on-windows-phone-7/
This example in the link passes along the header for Authorization
If you make a web reference to the php service, then I can point to the person who already asked it before here on the forum.
Adding SOAP headers to ASMX service requests

If you are using nuSoap, you can go the library, you'll find the code where packet response is been generated. There you can add your own attributes and headers as per your requirement.

Related

Should I be using REST or SOAP UI for testing?

I am testing a new webservice that is receiving messages from an application and responding with messages with specific information. The webservice then uses this information to create new messages for downstream systems. I need to know the best way I can test this using the Ready API tool, we just got a pro license. Is it SOAP or REST I need to use. Ideally I want to simply copy my application messages in to the tool, call the webservice and get the response, which I can then check is the correct response for the test
To find your web-service is SOAP or REST.
Please check whether your web service has WSDL to verify it has SOAP web-service, you can get your web-service's WSDL by post-fixing WSDL with your web service url.
Eg: http://{yourservice-url/path1}?WSDL
If your service don't provide WSDL from the above URL, then your web-service is REST.

Adding response Header in WSDL on runtime

We are using Siebel CRM for an inbound integration and using session management based soap requests and response. The problem is that when we generate WSDL from Siebel it does not include session management related header neither in request nor in response. We are using .net application to call Siebel inbound web service.
Now, our .net application is based on the classes generated after de-serialization of the Siebel generated WSDL and it is not including session response header. Session response header is being inserted by Siebel on run-time. Due to this our .net application could not get the session header.
What solution can be for the above problem from .net or Siebel side ?
I don't think Siebel generates this part in it's WSDL, the examples on Oracle and other blogs mention that the extra Headers need to be sent in the incoming SOAP to Siebel, but they are not present in the generated WSDL.
You will have to modify the WSDL after it is generated from Siebel, and then add the header section in it. Then your .NET side can parse out this section. Or you will have to handle the session side in the .NET app.config file

How to build soap to rest gateway

How would you build a soap to rest gateway with the least amount of work? I provide a REST API on my Rails 3.2 server. My customer requires me to provide a SOAP API. I don't want to use Rails for providing the SOAP API since that would probably take much more work than building a SOAP to REST gateway using a framework that fully supports SOAP.
I just noticed that Rails 3.2 parses SOAP requests automatically into the params hash (ActionDispatch::ParamsParser Rack middleware). So, I decided to implement the gateway in Rails. Since I don't really care to implement a full featured SOAP Server--all I want is to make it work for my customer's current SOAP client--I will just read the data that I need from the params hash and build the xml response using Builder and publish a static wsdl file if they need it. It will be less than 20 lines of code.
config/routes.rb
Gateway::Application.routes.draw do
match "/clientx/echo" => "clientx#echo"
end
app/controllers/clientx_controller.rb
class ClientxController < ApplicationController
def echo
# authenticate client
# parse params
# send and receive rest request
# render response
end
end
What about Mule ESB? Supports a various form of input and output possibilities. Implemented a SOAP-receiving application based on Mule myself.

CXF Jax-RS server service returning only header but no response JSON

I have a very basic Rest Server which returns JSON object. I tested it with Poster Firefox extension and I get both header and response.
But we have a test javascript client, which calls the service and when checked with Firebug, we see there is a header but no response.
To be sure, we tested the client with another JSON server and the client can read both the header and response.
As I mentioned, it is a very basic Apache CXF, Jax-RS service, so we are not sure what could be missing , that prevents from sending response or prevents client from reading response.
Will appreciate any help or input.
thank you
Walker
It wasn't the server it was the client which was not able to read the response properly.

creating a POST request in objective-C

I have implemented a REST based web service and used it to access data back in MySQL database.
I am using this framework to access the json data http://code.google.com/p/json-framework/
I have no problems in getting the content from this web service, but how can I put something in the database? Should I just make a special query string and have the php code in the backend to interpret this special keyword/query string as an insert to the database?
You're looking for ASIHTTPRequest. You can use that for everything from dumping pages to submitting data via POST or FORM.
Have fun :)
POST is a HTTP method. Your web service should behave differently depending on the method used for the request, if you're implementing REST.
If you send a POST request, your web service should inspect the parameters and do what it needs to do.
What parameters you send and how is dependent on how you've written the web service. Ie. Is the web service expecting XML requests or JSON or URL parameters?