Skip to main content

JSON return type results in Wrong binding ID error at run-time

1 reply [Last post]
jetaber
Offline
Joined: 2007-09-21
Points: 0

Working with the sample JAX-WS application here http://java.sun.com/developer/technicalArticles/J2SE/jax_ws_2/ I have added method that returns a JSONObject.

package ws;

import javax.jws.WebService;
import javax.xml.ws.BindingType;

import org.json.simple.JSONObject;
import org.jvnet.jax_ws_commons.json.JSONBindingID;

@WebService
@BindingType (JSONBindingID.JSON_BINDING)

public class CircleFunctions {

public JSONObject getJsonObject() {
JSONObject foo = new JSONObject();
foo.put("foo", "Bar");
return foo;
}
}

However, when I go to run my main class

package ws;
import javax.xml.ws.Endpoint;

public class WSDriver {

/**
* @param args
*/
public static void main(String[] args) {
Endpoint.publish(
"http://localhost:8080/WebServiceExample/circlefunctions",
new CircleFunctions());
}
}

I get the following error

Exception in thread "main" javax.xml.ws.WebServiceException: Wrong binding ID: https://jax-ws-commons.dev.java.net/json/
at com.sun.xml.internal.ws.api.BindingID.parse(BindingID.java:263)
at com.sun.xml.internal.ws.api.BindingID.parse(BindingID.java:314)
at com.sun.xml.internal.ws.spi.ProviderImpl.createAndPublishEndpoint(ProviderImpl.java:99)
at javax.xml.ws.Endpoint.publish(Endpoint.java:170)
at ws.WSDriver.main(WSDriver.java:60)

Assistance is greatly appreciated.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
daniloabreu
Offline
Joined: 2011-02-02
Points: 0

jetaber,
How you managed to solve this problem?
Because I'm experiencing the same difficulty, and not meeting solution.