简体   繁体   中英

getting UnsupportedMediaException when consuming soap wsdl webservice in jdeveloper

The error:

Exception in thread "main" com.sun.xml.internal.ws.server.UnsupportedMediaException: Unsupported Content-Type: application/xml Supported ones are: [text/xml] at com.sun.xml.internal.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:220) at com.sun.xml.internal.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:151) at com.sun.xml.internal.ws.encoding.SOAPBindingCodec.decode(SOAPBindingCodec.java:299) at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.createResponsePacket(HttpTransportPipe.java:268) at Z4D236 D9A2D102C5FE6AD1C50DA4BEC50Z.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:217) at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:130) at com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:95) at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Fiber.java:1121) at com.sun.xml.internal.ws.api.Z20826A3CB5 1D6C7D9C219C7F4BF4E5C9Z.Fiber._doRun(Fiber.java:1035) at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Fiber.java:1004) at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Fiber.java:862) at com.sun.xml.internal.ws.client.Stub.process(Stub.java:448) at com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(SEIStub.java:178) at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.Z93F725A07423FE1 C889F448B33D21F46Z:93) at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:77) at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:147) at com.sun.proxy.$Proxy36.getService(Unknown Source) at someClient.SomeClient.main(WaselClient.java:23)

I have created a custom application to consume wsdl and a client to execute webservice. but I am getting above error when running client.

public static void main(String[] args) {
    WaselClient waselClient = new WaselClient();
    
    WaselAddressService waselAddressService = new WaselAddressService();
    IWaselAddressService iWaselAddressService = waselAddressService.getBasicHttpBindingIWaselAddressService();
    try {
        
        GetAddressResponseStructure address =
            iWaselAddressService.getIndividualWaselAddress(ItemChoiceType.ID, "999999");
        
        System.out.println("" + address.getGetIndividualWaselAddressResponseDetailObject()
                                       .getWaselAddress()
                                       .get(1));
    } catch (IWaselAddressServiceGetIndividualWaselAddressCommonErrorElementFaultMessage e) {
        System.out.println(e.getMessage());
    }
    
    
}

I called the wsdl from SOAP UI and Postman, SOAP UI is returning result but Postman is returning 500-Internal Server Error.

SOAP webservice was returning application/xml for some unhandled exception occurred in web service, exception raised as request payload header contains content-type="text/xml; charset:utf-8" where as SOAP wsdl is accepting only "text/xml". they did not handle this case in their webservice

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM