[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1251
  • Last Modified:

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.
0
Cyber-EE
Asked:
Cyber-EE
  • 11
  • 7
  • 5
2 Solutions
 
objectsCommented:
0
 
Cyber-EEAuthor Commented:
Hi,

ThanX 4 the reply. I tried to do as the document explained but still get the same result...
0
 
objectsCommented:
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
CEHJCommented:
You need to use JAX-WS and enable MOTM. See

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

0
 
Cyber-EEAuthor Commented:
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.... :(
0
 
CEHJCommented:
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
0
 
Cyber-EEAuthor Commented:
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..
0
 
CEHJCommented:
Are you using jaxws as client API?
0
 
Cyber-EEAuthor Commented:
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?
0
 
Cyber-EEAuthor Commented:
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.
0
 
objectsCommented:
0
 
Cyber-EEAuthor Commented:
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
0
 
CEHJCommented:
Are we able to call this ourselves?
0
 
Cyber-EEAuthor Commented:
No...
0
 
Cyber-EEAuthor Commented:
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
0
 
CEHJCommented:
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
0
 
Cyber-EEAuthor Commented:
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?
0
 
objectsCommented:
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)

0
 
Cyber-EEAuthor Commented:
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.
0
 
Cyber-EEAuthor Commented:
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
0
 
CEHJCommented:
>>Am i using a different java version then you?

Well i did it with Java 6 but did get the very latest JAX-WS first, so try doing the latter and adding that latest library to the project instead. Get rid of the existing JAX-WS libraries
0
 
CEHJCommented:
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.
0

Featured Post

Automating Your MSP Business

The road to profitability.
Delivering superior services is key to ensuring customer satisfaction and the consequent long-term relationships that enable MSPs to lock in predictable, recurring revenue. What's the best way to deliver superior service? One word: automation.

  • 11
  • 7
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now