You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by Yanmin Sheng <ym...@gmail.com> on 2013/03/11 06:56:58 UTC

Can anybody take a look at CXF-4836?

We create such client which will set target address info and binding
info in RequestContext of BindingProvider.

String mtom11URL = "http://localhost:9080//MyBusiness/MTOM11Service";

MTOMInterface port = null;
BindingProvider bp = null;

System.out.println("Looking up SOAP 1.1 MTOM service");

QName serviceName = new QName("http://shengym.com/MyBusiness/","MTOM11Service");
QName portName = new QName("http://shengym.com/MyBusiness", "MTOM11Port");
// Setup the necessary JAX-WS artifacts
Service svc = Service.create(serviceName);
port = svc.getPort(portName, MTOMInterface.class);

// Set the target URL
bp = (BindingProvider) port;
Map<String, Object> requestCtx = bp.getRequestContext();
requestCtx.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,mtom11URL);

// Enable MTOM
SOAPBinding binding = (SOAPBinding) bp.getBinding();
binding.setMTOMEnabled(true);

However, it reports such error:

javax.xml.ws.WebServiceException:Port
{http://shengym.com/MyBusiness/}

MTOM11Port not found.
org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:332)
org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:323)
javax.xml.ws.Service.getPort(Service.java:134)

I know that the added following code can fix this error:
svc.addPort(portName, SOAPBinding.SOAP11HTTP_MTOM_BINDING, mtom11URL);

Well, this error should not report even the addPort method is not called.
I know the added check in ServiceImpl is to avoid run time error and
report it as early as possible. But I think it is not needed. The
reasons are:
1. User can get run time error later;
2. User can set target addess info and bind info in other ways (as my
example shows)

I remove the check from the ServiceImpl then my client code works well.

Re: Can anybody take a look at CXF-4836?

Posted by zhubinbj <lu...@gmail.com>.
Hi,
I got the same issue as described in this mail. And svc.addPort code seems
to be only needed for MTOM service. The non-MTOM service is working without
this code. 
Can anyone confirm that is should be fixed? Seems needs to run the TCK with
this change.



--
View this message in context: http://cxf.547215.n5.nabble.com/Can-anybody-take-a-look-at-CXF-4836-tp5724362p5730888.html
Sent from the cxf-dev mailing list archive at Nabble.com.

Re: Can anybody take a look at CXF-4836?

Posted by Ivan <xh...@gmail.com>.
It looks like that this kind of usage is allowed while running on Axis2.
Considering that, Geronimo 3.* (Axis2 assembly) has passed the JaxWs 2.2
TCK, guess that this should not an issue for CTS, while it is reasonable
that we could have one round TCK to double confirm that.  Will CXF run TCK
for each new release ? If does, think that we could try that in the next
release.

Thanks.


2013/3/13 Daniel Kulp <dk...@apache.org>

>
> I don't see any problem removing the check, but I'm not really sure why
> the check is there.
>
> Looking in the logs, this check was added way way back when Dan Diephouse,
> Jeff Genender, Jarek Gawor, and myself were pushing hard to get the JAX-WS
> 2.0 TCK to pass (and for Geronimo to use CXF for JAX-WS).   Thus, my gut
> feeling is that something in the TCK required it at one point.   I don't
> know if some test in the current TCK's require it.   I haven't had the time
> to run the TCK with your change in place to see what, if anything, might
> break.
>
> Dan
>
>
>
> On Mar 11, 2013, at 10:51 PM, Yanmin Sheng <ym...@gmail.com> wrote:
>
> > Hi,
> >   Thanks for your quick response. I know it is a implementation
> > specific manner (e.g., lazy and eager validation ). But actualy I can
> > send out the message in CXF by removing the portInfo check in getPort
> > by setting the endpoint address in BindingProvider. If we throw
> > exception early, then I do not think I have chance to set address info
> > in BindingProvider.
> >               QName serviceName = new
> > QName("http://shengym.com/MyBusiness/","MTOM11Service");
> >               QName portName = new QName("http://shengym.com/MyBusiness",
> "MTOM11Port");
> >               // Setup the necessary JAX-WS artifacts
> >               Service svc = Service.create(serviceName);
> >               port = svc.getPort(portName, MTOMInterface.class);
> >
> >               // Set the target URL
> >               bp = (BindingProvider) port;
> >               Map<String, Object> requestCtx = bp.getRequestContext();
> >
> requestCtx.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,mtom11URL);
> >
> >
> > On Mon, Mar 11, 2013 at 2:58 PM, Willem jiang <wi...@gmail.com>
> wrote:
> >> Hi,
> >>
> >> If you just call the Service svc = Service.create(serviceName);
> >> CXF know nothing about how to build the ServiceModel as it's only a
> ServiceName.
> >> When you call
> >> port = svc.getPort(portName, MTOMInterface.class);
> >> It can build the ServiceModel according to the MTOMInterface.class, but
> it doesn't know anything about the endpoint address.
> >> If we don't through the exception here, user will think the port object
> is OK for sending invocation, and it is hard for him to track the issue in
> the run time.
> >> You still need to call the svc.addPort for it.
> >>
> >> BTW, it's typical usage of JAXWS API, I don't think there is anything
> wrong with it.
> >>
> >> --
> >> Willem Jiang
> >>
> >> Red Hat, Inc.
> >> FuseSource is now part of Red Hat
> >> Web: http://www.fusesource.com | http://www.redhat.com
> >> Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/)
> (English)
> >>          http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
> >> Twitter: willemjiang
> >> Weibo: 姜宁willem
> >>
> >>
> >>
> >>
> >>
> >> On Monday, March 11, 2013 at 1:56 PM, Yanmin Sheng wrote:
> >>
> >>> We create such client which will set target address info and binding
> >>> info in RequestContext of BindingProvider.
> >>>
> >>> String mtom11URL = "http://localhost:9080//MyBusiness/MTOM11Service";
> >>>
> >>> MTOMInterface port = null;
> >>> BindingProvider bp = null;
> >>>
> >>> System.out.println("Looking up SOAP 1.1 MTOM service");
> >>>
> >>> QName serviceName = new QName("http://shengym.com/MyBusiness/
> ","MTOM11Service");
> >>> QName portName = new QName("http://shengym.com/MyBusiness",
> "MTOM11Port");
> >>> // Setup the necessary JAX-WS artifacts
> >>> Service svc = Service.create(serviceName);
> >>> port = svc.getPort(portName, MTOMInterface.class);
> >>>
> >>> // Set the target URL
> >>> bp = (BindingProvider) port;
> >>> Map<String, Object> requestCtx = bp.getRequestContext();
> >>> requestCtx.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,mtom11URL);
> >>>
> >>> // Enable MTOM
> >>> SOAPBinding binding = (SOAPBinding) bp.getBinding();
> >>> binding.setMTOMEnabled(true);
> >>>
> >>> However, it reports such error:
> >>>
> >>> javax.xml.ws.WebServiceException:Port
> >>> {http://shengym.com/MyBusiness/}
> >>>
> >>> MTOM11Port not found.
> >>> org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:332)
> >>> org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:323)
> >>> javax.xml.ws.Service.getPort(Service.java:134)
> >>>
> >>> I know that the added following code can fix this error:
> >>> svc.addPort(portName, SOAPBinding.SOAP11HTTP_MTOM_BINDING, mtom11URL);
> >>>
> >>> Well, this error should not report even the addPort method is not
> called.
> >>> I know the added check in ServiceImpl is to avoid run time error and
> >>> report it as early as possible. But I think it is not needed. The
> >>> reasons are:
> >>> 1. User can get run time error later;
> >>> 2. User can set target addess info and bind info in other ways (as my
> >>> example shows)
> >>>
> >>> I remove the check from the ServiceImpl then my client code works well.
> >>
> >>
>
> --
> Daniel Kulp
> dkulp@apache.org - http://dankulp.com/blog
> Talend Community Coder - http://coders.talend.com
>
>


-- 
Ivan

Re: Can anybody take a look at CXF-4836?

Posted by Daniel Kulp <dk...@apache.org>.
I don't see any problem removing the check, but I'm not really sure why the check is there.

Looking in the logs, this check was added way way back when Dan Diephouse, Jeff Genender, Jarek Gawor, and myself were pushing hard to get the JAX-WS 2.0 TCK to pass (and for Geronimo to use CXF for JAX-WS).   Thus, my gut feeling is that something in the TCK required it at one point.   I don't know if some test in the current TCK's require it.   I haven't had the time to run the TCK with your change in place to see what, if anything, might break.

Dan



On Mar 11, 2013, at 10:51 PM, Yanmin Sheng <ym...@gmail.com> wrote:

> Hi,
>   Thanks for your quick response. I know it is a implementation
> specific manner (e.g., lazy and eager validation ). But actualy I can
> send out the message in CXF by removing the portInfo check in getPort
> by setting the endpoint address in BindingProvider. If we throw
> exception early, then I do not think I have chance to set address info
> in BindingProvider.
> 	        QName serviceName = new
> QName("http://shengym.com/MyBusiness/","MTOM11Service");
> 		QName portName = new QName("http://shengym.com/MyBusiness", "MTOM11Port");
> 		// Setup the necessary JAX-WS artifacts
> 		Service svc = Service.create(serviceName);
> 		port = svc.getPort(portName, MTOMInterface.class);
> 
> 		// Set the target URL
> 		bp = (BindingProvider) port;
> 		Map<String, Object> requestCtx = bp.getRequestContext();
> 		requestCtx.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,mtom11URL);
> 
> 
> On Mon, Mar 11, 2013 at 2:58 PM, Willem jiang <wi...@gmail.com> wrote:
>> Hi,
>> 
>> If you just call the Service svc = Service.create(serviceName);
>> CXF know nothing about how to build the ServiceModel as it's only a ServiceName.
>> When you call
>> port = svc.getPort(portName, MTOMInterface.class);
>> It can build the ServiceModel according to the MTOMInterface.class, but it doesn't know anything about the endpoint address.
>> If we don't through the exception here, user will think the port object is OK for sending invocation, and it is hard for him to track the issue in the run time.
>> You still need to call the svc.addPort for it.
>> 
>> BTW, it's typical usage of JAXWS API, I don't think there is anything wrong with it.
>> 
>> --
>> Willem Jiang
>> 
>> Red Hat, Inc.
>> FuseSource is now part of Red Hat
>> Web: http://www.fusesource.com | http://www.redhat.com
>> Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
>>          http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
>> Twitter: willemjiang
>> Weibo: 姜宁willem
>> 
>> 
>> 
>> 
>> 
>> On Monday, March 11, 2013 at 1:56 PM, Yanmin Sheng wrote:
>> 
>>> We create such client which will set target address info and binding
>>> info in RequestContext of BindingProvider.
>>> 
>>> String mtom11URL = "http://localhost:9080//MyBusiness/MTOM11Service";
>>> 
>>> MTOMInterface port = null;
>>> BindingProvider bp = null;
>>> 
>>> System.out.println("Looking up SOAP 1.1 MTOM service");
>>> 
>>> QName serviceName = new QName("http://shengym.com/MyBusiness/","MTOM11Service");
>>> QName portName = new QName("http://shengym.com/MyBusiness", "MTOM11Port");
>>> // Setup the necessary JAX-WS artifacts
>>> Service svc = Service.create(serviceName);
>>> port = svc.getPort(portName, MTOMInterface.class);
>>> 
>>> // Set the target URL
>>> bp = (BindingProvider) port;
>>> Map<String, Object> requestCtx = bp.getRequestContext();
>>> requestCtx.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,mtom11URL);
>>> 
>>> // Enable MTOM
>>> SOAPBinding binding = (SOAPBinding) bp.getBinding();
>>> binding.setMTOMEnabled(true);
>>> 
>>> However, it reports such error:
>>> 
>>> javax.xml.ws.WebServiceException:Port
>>> {http://shengym.com/MyBusiness/}
>>> 
>>> MTOM11Port not found.
>>> org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:332)
>>> org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:323)
>>> javax.xml.ws.Service.getPort(Service.java:134)
>>> 
>>> I know that the added following code can fix this error:
>>> svc.addPort(portName, SOAPBinding.SOAP11HTTP_MTOM_BINDING, mtom11URL);
>>> 
>>> Well, this error should not report even the addPort method is not called.
>>> I know the added check in ServiceImpl is to avoid run time error and
>>> report it as early as possible. But I think it is not needed. The
>>> reasons are:
>>> 1. User can get run time error later;
>>> 2. User can set target addess info and bind info in other ways (as my
>>> example shows)
>>> 
>>> I remove the check from the ServiceImpl then my client code works well.
>> 
>> 

-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com


Re: Can anybody take a look at CXF-4836?

Posted by Yanmin Sheng <ym...@gmail.com>.
Hi,

I found The JSR 224 spec has the following statement:

4.1 javax.xml.Service
Create a new port via the addPortmethod. Such ports only include
binding and endpoint information
and are thus ONLY suitable for creating Dispatch instances since these
do not requireWSDL port type
information.

So I do not think the exception should be thrown here as proxy is used
in this case not dispatch.


On Tue, Mar 12, 2013 at 10:51 AM, Yanmin Sheng <ym...@gmail.com> wrote:
> Hi,
>    Thanks for your quick response. I know it is a implementation
> specific manner (e.g., lazy and eager validation ). But actualy I can
> send out the message in CXF by removing the portInfo check in getPort
> by setting the endpoint address in BindingProvider. If we throw
> exception early, then I do not think I have chance to set address info
> in BindingProvider.
>                 QName serviceName = new
> QName("http://shengym.com/MyBusiness/","MTOM11Service");
>                 QName portName = new QName("http://shengym.com/MyBusiness", "MTOM11Port");
>                 // Setup the necessary JAX-WS artifacts
>                 Service svc = Service.create(serviceName);
>                 port = svc.getPort(portName, MTOMInterface.class);
>
>                 // Set the target URL
>                 bp = (BindingProvider) port;
>                 Map<String, Object> requestCtx = bp.getRequestContext();
>                 requestCtx.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,mtom11URL);
>
>
> On Mon, Mar 11, 2013 at 2:58 PM, Willem jiang <wi...@gmail.com> wrote:
>> Hi,
>>
>> If you just call the Service svc = Service.create(serviceName);
>> CXF know nothing about how to build the ServiceModel as it's only a ServiceName.
>> When you call
>> port = svc.getPort(portName, MTOMInterface.class);
>> It can build the ServiceModel according to the MTOMInterface.class, but it doesn't know anything about the endpoint address.
>> If we don't through the exception here, user will think the port object is OK for sending invocation, and it is hard for him to track the issue in the run time.
>> You still need to call the svc.addPort for it.
>>
>> BTW, it's typical usage of JAXWS API, I don't think there is anything wrong with it.
>>
>> --
>> Willem Jiang
>>
>> Red Hat, Inc.
>> FuseSource is now part of Red Hat
>> Web: http://www.fusesource.com | http://www.redhat.com
>> Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
>>           http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
>> Twitter: willemjiang
>> Weibo: 姜宁willem
>>
>>
>>
>>
>>
>> On Monday, March 11, 2013 at 1:56 PM, Yanmin Sheng wrote:
>>
>>> We create such client which will set target address info and binding
>>> info in RequestContext of BindingProvider.
>>>
>>> String mtom11URL = "http://localhost:9080//MyBusiness/MTOM11Service";
>>>
>>> MTOMInterface port = null;
>>> BindingProvider bp = null;
>>>
>>> System.out.println("Looking up SOAP 1.1 MTOM service");
>>>
>>> QName serviceName = new QName("http://shengym.com/MyBusiness/","MTOM11Service");
>>> QName portName = new QName("http://shengym.com/MyBusiness", "MTOM11Port");
>>> // Setup the necessary JAX-WS artifacts
>>> Service svc = Service.create(serviceName);
>>> port = svc.getPort(portName, MTOMInterface.class);
>>>
>>> // Set the target URL
>>> bp = (BindingProvider) port;
>>> Map<String, Object> requestCtx = bp.getRequestContext();
>>> requestCtx.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,mtom11URL);
>>>
>>> // Enable MTOM
>>> SOAPBinding binding = (SOAPBinding) bp.getBinding();
>>> binding.setMTOMEnabled(true);
>>>
>>> However, it reports such error:
>>>
>>> javax.xml.ws.WebServiceException:Port
>>> {http://shengym.com/MyBusiness/}
>>>
>>> MTOM11Port not found.
>>> org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:332)
>>> org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:323)
>>> javax.xml.ws.Service.getPort(Service.java:134)
>>>
>>> I know that the added following code can fix this error:
>>> svc.addPort(portName, SOAPBinding.SOAP11HTTP_MTOM_BINDING, mtom11URL);
>>>
>>> Well, this error should not report even the addPort method is not called.
>>> I know the added check in ServiceImpl is to avoid run time error and
>>> report it as early as possible. But I think it is not needed. The
>>> reasons are:
>>> 1. User can get run time error later;
>>> 2. User can set target addess info and bind info in other ways (as my
>>> example shows)
>>>
>>> I remove the check from the ServiceImpl then my client code works well.
>>
>>

Re: Can anybody take a look at CXF-4836?

Posted by Yanmin Sheng <ym...@gmail.com>.
Hi,
   Thanks for your quick response. I know it is a implementation
specific manner (e.g., lazy and eager validation ). But actualy I can
send out the message in CXF by removing the portInfo check in getPort
by setting the endpoint address in BindingProvider. If we throw
exception early, then I do not think I have chance to set address info
in BindingProvider.
	        QName serviceName = new
QName("http://shengym.com/MyBusiness/","MTOM11Service");
		QName portName = new QName("http://shengym.com/MyBusiness", "MTOM11Port");
		// Setup the necessary JAX-WS artifacts
		Service svc = Service.create(serviceName);
		port = svc.getPort(portName, MTOMInterface.class);

		// Set the target URL
		bp = (BindingProvider) port;
		Map<String, Object> requestCtx = bp.getRequestContext();
		requestCtx.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,mtom11URL);


On Mon, Mar 11, 2013 at 2:58 PM, Willem jiang <wi...@gmail.com> wrote:
> Hi,
>
> If you just call the Service svc = Service.create(serviceName);
> CXF know nothing about how to build the ServiceModel as it's only a ServiceName.
> When you call
> port = svc.getPort(portName, MTOMInterface.class);
> It can build the ServiceModel according to the MTOMInterface.class, but it doesn't know anything about the endpoint address.
> If we don't through the exception here, user will think the port object is OK for sending invocation, and it is hard for him to track the issue in the run time.
> You still need to call the svc.addPort for it.
>
> BTW, it's typical usage of JAXWS API, I don't think there is anything wrong with it.
>
> --
> Willem Jiang
>
> Red Hat, Inc.
> FuseSource is now part of Red Hat
> Web: http://www.fusesource.com | http://www.redhat.com
> Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
>           http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
> Twitter: willemjiang
> Weibo: 姜宁willem
>
>
>
>
>
> On Monday, March 11, 2013 at 1:56 PM, Yanmin Sheng wrote:
>
>> We create such client which will set target address info and binding
>> info in RequestContext of BindingProvider.
>>
>> String mtom11URL = "http://localhost:9080//MyBusiness/MTOM11Service";
>>
>> MTOMInterface port = null;
>> BindingProvider bp = null;
>>
>> System.out.println("Looking up SOAP 1.1 MTOM service");
>>
>> QName serviceName = new QName("http://shengym.com/MyBusiness/","MTOM11Service");
>> QName portName = new QName("http://shengym.com/MyBusiness", "MTOM11Port");
>> // Setup the necessary JAX-WS artifacts
>> Service svc = Service.create(serviceName);
>> port = svc.getPort(portName, MTOMInterface.class);
>>
>> // Set the target URL
>> bp = (BindingProvider) port;
>> Map<String, Object> requestCtx = bp.getRequestContext();
>> requestCtx.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,mtom11URL);
>>
>> // Enable MTOM
>> SOAPBinding binding = (SOAPBinding) bp.getBinding();
>> binding.setMTOMEnabled(true);
>>
>> However, it reports such error:
>>
>> javax.xml.ws.WebServiceException:Port
>> {http://shengym.com/MyBusiness/}
>>
>> MTOM11Port not found.
>> org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:332)
>> org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:323)
>> javax.xml.ws.Service.getPort(Service.java:134)
>>
>> I know that the added following code can fix this error:
>> svc.addPort(portName, SOAPBinding.SOAP11HTTP_MTOM_BINDING, mtom11URL);
>>
>> Well, this error should not report even the addPort method is not called.
>> I know the added check in ServiceImpl is to avoid run time error and
>> report it as early as possible. But I think it is not needed. The
>> reasons are:
>> 1. User can get run time error later;
>> 2. User can set target addess info and bind info in other ways (as my
>> example shows)
>>
>> I remove the check from the ServiceImpl then my client code works well.
>
>

Re: Can anybody take a look at CXF-4836?

Posted by Willem jiang <wi...@gmail.com>.
Hi,

If you just call the Service svc = Service.create(serviceName);
CXF know nothing about how to build the ServiceModel as it's only a ServiceName.
When you call  
port = svc.getPort(portName, MTOMInterface.class);
It can build the ServiceModel according to the MTOMInterface.class, but it doesn't know anything about the endpoint address.
If we don't through the exception here, user will think the port object is OK for sending invocation, and it is hard for him to track the issue in the run time.  
You still need to call the svc.addPort for it.

BTW, it's typical usage of JAXWS API, I don't think there is anything wrong with it.   

--  
Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem





On Monday, March 11, 2013 at 1:56 PM, Yanmin Sheng wrote:

> We create such client which will set target address info and binding
> info in RequestContext of BindingProvider.
>  
> String mtom11URL = "http://localhost:9080//MyBusiness/MTOM11Service";
>  
> MTOMInterface port = null;
> BindingProvider bp = null;
>  
> System.out.println("Looking up SOAP 1.1 MTOM service");
>  
> QName serviceName = new QName("http://shengym.com/MyBusiness/","MTOM11Service");
> QName portName = new QName("http://shengym.com/MyBusiness", "MTOM11Port");
> // Setup the necessary JAX-WS artifacts
> Service svc = Service.create(serviceName);
> port = svc.getPort(portName, MTOMInterface.class);
>  
> // Set the target URL
> bp = (BindingProvider) port;
> Map<String, Object> requestCtx = bp.getRequestContext();
> requestCtx.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,mtom11URL);
>  
> // Enable MTOM
> SOAPBinding binding = (SOAPBinding) bp.getBinding();
> binding.setMTOMEnabled(true);
>  
> However, it reports such error:
>  
> javax.xml.ws.WebServiceException:Port
> {http://shengym.com/MyBusiness/}
>  
> MTOM11Port not found.
> org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:332)
> org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:323)
> javax.xml.ws.Service.getPort(Service.java:134)
>  
> I know that the added following code can fix this error:
> svc.addPort(portName, SOAPBinding.SOAP11HTTP_MTOM_BINDING, mtom11URL);
>  
> Well, this error should not report even the addPort method is not called.
> I know the added check in ServiceImpl is to avoid run time error and
> report it as early as possible. But I think it is not needed. The
> reasons are:
> 1. User can get run time error later;
> 2. User can set target addess info and bind info in other ways (as my
> example shows)
>  
> I remove the check from the ServiceImpl then my client code works well.