Link to home
Start Free TrialLog in
Avatar of Cyber-EE
Cyber-EE

asked on

Calling a .Net web service that uses MTOM from java application with SDK 1.5

Hi,

Im a rather new user in java. I have a project in .Net that has 1 web services that uses the MTOM protocol to download a file. I want to use this web service but from a java applet.
When i call the web service (After i added a new web client to the applet project) I get the error message "HTTP Status-Code 415: Unsupported Media Type".
If i do the same but call a web service that does not use MTOM then it works fine.
Can someone please help me? I've searched the web but did not find any usable information. This is might be becuase im a new user and don't know what to search for :)
Thank you.
ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Cyber-EE
Cyber-EE

ASKER

Hi,

ThanX 4 the reply. I tried to do as the document explained but still get the same result...
You need to use JAX-WS and enable MOTM. See

http://java.sun.com/webservices/docs/2.0/jaxws/mtom-swaref.html
enabling motm has already been suggested.

Hello to all,

A read the link that objects told me and i think that it is not my case because as i said i already checked MTOM using a client and web service in .NET and it worked fine.
Regrading the 2nd link i was given - As i understand, they talk about enabling a web service that was written in Java and how to enable it for MTOM. This is not my case. I might have not understand the solution but i tired all that was written there and no luck.... :(
My link discusses the server *and client*:

>>MTOM feature is disabled in jaxws by default. It can be enabled on the client and server.

and there is an example later of enabling support in the client
Yes, you are correct but i already tried that way to enable MTOM but it seems to have no effect. I still get the error  "HTTP Status-Code 415: Unsupported Media Type".
I am sure im missing something but because i new to Java i don't know what..
Are you using jaxws as client API?
Hi CEHJ,

As i said at the start :) iam am new to java... Can you explain what you mean. I did install the jaxws library in my project.
Maybe you want me to explain what are the steps i did to create a web service client? It might help you understand my problem?
Hi again,

I found an artical on the jaxws client API. i'll try to use it and let you know.
I actually created a web service client using the the Netbeans option to call web service resources.
still not working.
Will it help you if i add the code that i use to create the client and the wsdl file?
If you need something else let me know.
ThanX
Are we able to call this ourselves?
No...
Hi,

Now you can call it from
http://194.90.225.103/mtom/mtomwse.asmx?wsdl

Please let me know if you can help me.
ThanX
Yes, i've done it successfully using my own advice. See my code below. I also attach an image of the output in Netbeans:
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
 
package webservice;
 
import javax.xml.ws.soap.SOAPBinding;
import javax.xml.ws.BindingProvider;
 
/**
 *
 * @author goose
 */
public class Main {
 
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        
        MTOMWse mtom = new MTOMWse();
        
        MTOMWseSoap soap = mtom.getMTOMWseSoap12();
 
 
        SOAPBinding binding = (SOAPBinding)((BindingProvider)soap).getBinding();
        binding.setMTOMEnabled(true);
 
        System.out.println(soap.helloWorld());
    }
 
}

Open in new window

nb.png
Hi,

1st of all thanX for the reply.
I noticed that you used mtom.getMTOMWseSoap12();
In my test i used mtom.getMTOMWseSoap(); so tried your way and noticed that when i refresh the web client and build the project i get the message "warning: SOAP port "MTOMWseSoap12": uses a non-standard SOAP 1.2 binding.". This is after got the message "warning: Ignoring SOAP port "MTOMWseSoap12": it uses non-standard SOAP 1.2 binding.
You must specify the "-extension" option to use this binding." and add "extention="true"" to the "build-impl.xml".
I am still getting the "HTTP Status-Code 415: Unsupported Media Type". when running it.
Am i using a different java version then you? Might this be why i keep getting the HTTP error?
not sure why he used that binding. did you try the lab I posted earlier?
( i don't use netbeans so can't try it here)

I'll try the lab you gave me again because the 1st time i tried i had some problems using it.
About the soap12 binding i installaed SDK 1.6 with netbeans 6 and still got the HTTP error.
I am having problems using the lab demo as is. If I need to do changes in the code i prefer not do it because I don't have that time to spend on it. If someone, anyone, has another idea Ill appreciate it.
???

ThanX
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If you can't get it working, although of course it would be better for you to do so, i can always send it to you.