PHP calling .NET – Running WCF service with basicHttpBinding

2

Category : Interoperability, Microsoft, PHP, Software development

I am Writing a PHP application that needs to run a back end .NET application. When creating a running the WCF web service out of the box, the PHP could not connect to the web service.

The problem:

The PHP returns "Caught exception: Cannot process the message because the content type ‘text/xml; charset=utf-8′ was not the expected type ‘application/soap+xml; charset=utf-8′."

 

The reason:

WCF is running a new version of web services than expected by the PHP.

 

The solution:

Change the binding type of the WCF service from binding="wsHttpBinding" to binding="basicHttpBinding".

This insures that your .NET web service would support clients and other services that conform to the WS-I standards.

 



You can see an example of such configuration in my blog posts named:

PHP calling .NET – PHP to WCF communication

and

PHP calling .NET – PHP to WCF calls with parameters

Still waiting for true .NET – JAVA interoperability

Category : Interoperability, Java, Opinion

Still waiting for true interoperability

One of the big things presented in JavaOne was .NET-Java interoperability. The notion of language interoperability can be understood and implemented in several different ways.

Sun and Microsoft introduced interoperability by means of web-services (WS). It seems that short of a cure for cancer, web-services is the answer to everything. While in some conditions WS is a good way for applications (written in different language or the same) to interact, this seems like a cumbersome way for simple (POJO) situations especially when the two applications are on the same machine.

Our open-source project, MantaRay, also tries to achieve language interoperability. We provide our JMS offering in Java and .NET, thus you can send a message in C# and receive it in java and vice versa. We keep the protocol layer unified to provide our language interoperability, while this might be simpler or even faster than WS it basically suffers from the same shortcomings.

Another solution presented in the JavaOne pavilion was of shared memory between .NET and Java. This is an interesting approach for interoperability within the same machine. But it lacks an event driven mechanism and method invocation, you need to write your own code that checks if the shared variable has changed. So this is, in effect, a very thin offering.

And there is JNI for Java-C++ interoperability. In the alumni “fire side chat” the guys from SUN admitted, when asked why JNI invocation takes so long, that JNI is sometimes slow and that Java itself used “dirty optimizations” in order to achieve better C++ invocation speed.

There was a company that implemented a “source time/compile time” interoperability approach, you write you code in .NET and access Java libraries as you see fit. At compile time your code is converted to Java. They showed a very simple demo and I am not sure what the limitations of this solution are.

I have a dream, in my dream you write the code in any language you like and mash-up different languages. I would like to write a multi tier application, writing every tier in a different language, and not worry about interoperability.

Technology should enable things. It should be simple and efficient. Interoperability is an issue because of licensing, lack of standards, lack of good will and business competition. As developers, and consumers of technology, we must strive to be able to use the right tool for the right task, we should push for open standards and seamless interoperability. We must make sure the technology providers (Microsoft and Sun) know that is important for their business to provide this interoperability for us.

Amir Shevat
2006-05-28T07:45:38-08:00
[Amir blog and articles]