View Javadoc

1   /*
2    *  soapUI, copyright (C) 2004-2010 eviware.com 
3    *
4    *  soapUI is free software; you can redistribute it and/or modify it under the 
5    *  terms of version 2.1 of the GNU Lesser General Public License as published by 
6    *  the Free Software Foundation.
7    *
8    *  soapUI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 
9    *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
10   *  See the GNU Lesser General Public License for more details at gnu.org.
11   */
12  
13  package com.eviware.soapui.impl.wsdl;
14  
15  import java.beans.PropertyChangeEvent;
16  import java.beans.PropertyChangeListener;
17  import java.util.ArrayList;
18  import java.util.Arrays;
19  import java.util.List;
20  
21  import org.apache.log4j.Logger;
22  
23  import com.eviware.soapui.SoapUI;
24  import com.eviware.soapui.config.CredentialsConfig;
25  import com.eviware.soapui.config.WsdlRequestConfig;
26  import com.eviware.soapui.impl.rest.RestRequestInterface;
27  import com.eviware.soapui.impl.support.AbstractHttpRequest;
28  import com.eviware.soapui.impl.wsdl.submit.RequestTransportRegistry;
29  import com.eviware.soapui.impl.wsdl.submit.transports.http.WsdlResponse;
30  import com.eviware.soapui.impl.wsdl.submit.transports.http.support.attachments.AttachmentUtils;
31  import com.eviware.soapui.impl.wsdl.submit.transports.jms.JMSHeader;
32  import com.eviware.soapui.impl.wsdl.support.jms.header.JMSHeaderConfig;
33  import com.eviware.soapui.impl.wsdl.support.jms.property.JMSPropertiesConfig;
34  import com.eviware.soapui.impl.wsdl.support.wsa.WsaConfig;
35  import com.eviware.soapui.impl.wsdl.support.wsa.WsaContainer;
36  import com.eviware.soapui.impl.wsdl.support.wsrm.WsrmConfig;
37  import com.eviware.soapui.impl.wsdl.support.wsrm.WsrmContainer;
38  import com.eviware.soapui.model.ModelItem;
39  import com.eviware.soapui.model.iface.Interface;
40  import com.eviware.soapui.model.iface.MessagePart;
41  import com.eviware.soapui.model.iface.SubmitContext;
42  import com.eviware.soapui.model.iface.Attachment.AttachmentEncoding;
43  import com.eviware.soapui.model.propertyexpansion.PropertyExpander;
44  import com.eviware.soapui.model.propertyexpansion.PropertyExpansion;
45  import com.eviware.soapui.model.propertyexpansion.PropertyExpansionContainer;
46  import com.eviware.soapui.model.propertyexpansion.PropertyExpansionUtils;
47  import com.eviware.soapui.model.propertyexpansion.PropertyExpansionsResult;
48  import com.eviware.soapui.model.support.InterfaceListenerAdapter;
49  import com.eviware.soapui.settings.WsdlSettings;
50  import com.eviware.soapui.support.StringUtils;
51  import com.eviware.soapui.support.UISupport;
52  import com.eviware.soapui.support.types.StringToStringMap;
53  
54  /***
55   * Request implementation holding a SOAP request
56   * 
57   * @author Ole.Matzura
58   */
59  
60  public class WsdlRequest extends AbstractHttpRequest<WsdlRequestConfig> implements WsdlAttachmentContainer,
61  		PropertyExpansionContainer, WsaContainer, WsrmContainer
62  {
63  	public final static Logger log = Logger.getLogger( WsdlRequest.class );
64  
65  	public static final String RESPONSE_CONTENT_PROPERTY = WsdlRequest.class.getName() + "@response-content";
66  	public static final String INLINE_RESPONSE_ATTACHMENTS = WsdlRequest.class.getName()
67  			+ "@inline-response-attachments";
68  	public static final String EXPAND_MTOM_RESPONSE_ATTACHMENTS = WsdlRequest.class.getName()
69  			+ "@expand-mtom-attachments";
70  	public static final String FORCE_MTOM = WsdlRequest.class.getName() + "@force_mtom";
71  	public static final String ENABLE_INLINE_FILES = WsdlRequest.class.getName() + "@enable_inline_files";
72  	public static final String SKIP_SOAP_ACTION = WsdlRequest.class.getName() + "@skip_soap_action";
73  	public static final String ENCODE_ATTACHMENTS = WsdlRequest.class.getName() + "@encode_attachments";
74  	public static final String WSS_TIMETOLIVE = WsdlRequest.class.getName() + "@wss-time-to-live";
75  	public static final String OPERATION_PROPERTY = WsdlRequest.class.getName() + "@operation";
76  	public static final String INCOMING_WSS = WsdlRequest.class.getName() + "@incoming-wss";
77  	public static final String OUGOING_WSS = WsdlRequest.class.getName() + "@outgoing-wss";
78  
79  	public final static String PW_TYPE_NONE = "None";
80  	public final static String PW_TYPE_DIGEST = "PasswordDigest";
81  	public final static String PW_TYPE_TEXT = "PasswordText";
82  
83  	private WsdlOperation operation;
84  	private List<HttpAttachmentPart> definedAttachmentParts;
85  	private InternalInterfaceListener interfaceListener = new InternalInterfaceListener();
86  
87  	private WsaConfig wsaConfig;
88  	private WsrmConfig wsrmConfig;
89  
90  	public WsdlRequest( WsdlOperation operation, WsdlRequestConfig callConfig )
91  	{
92  		this( operation, callConfig, false );
93  	}
94  
95  	public WsdlRequest( WsdlOperation operation, WsdlRequestConfig callConfig, boolean forLoadTest )
96  	{
97  		super( callConfig, operation, null, forLoadTest );
98  
99  		this.operation = operation;
100 
101 		initEndpoints();
102 
103 		// ensure encoding
104 		if( callConfig.getEncoding() == null || callConfig.getEncoding().length() == 0 )
105 		{
106 			callConfig.setEncoding( "UTF-8" );
107 		}
108 
109 		if( !forLoadTest )
110 		{
111 			operation.getInterface().addPropertyChangeListener( interfaceListener );
112 			operation.getInterface().addInterfaceListener( interfaceListener );
113 		}
114 	}
115 
116 	public void updateConfig( WsdlRequestConfig request )
117 	{
118 		setConfig( request );
119 
120 		if( wsaConfig != null )
121 		{
122 			wsaConfig.setConfig( request.getWsaConfig() );
123 		}
124 
125 		if( wsrmConfig != null )
126 		{
127 			wsrmConfig.setWsrmConfig( request.getWsrmConfig() );
128 		}
129 		
130 		if( jmsHeaderConfig != null )
131 		{
132 			jmsHeaderConfig.setJMSHeaderConfConfig(  request.getJmsConfig() );
133 		}
134 		
135 		if( jmsPropertyConfig != null )
136 		{
137 			jmsPropertyConfig.setJmsPropertyConfConfig( request.getJmsPropertyConfig() );
138 		}
139 	}
140 
141 	protected void initEndpoints()
142 	{
143 		if( getEndpoint() == null )
144 		{
145 			String[] endpoints = operation.getInterface().getEndpoints();
146 			if( endpoints.length > 0 )
147 			{
148 				setEndpoint( endpoints[0] );
149 			}
150 		}
151 	}
152 
153 	public boolean isInlineResponseAttachments()
154 	{
155 		return getSettings().getBoolean( INLINE_RESPONSE_ATTACHMENTS );
156 	}
157 
158 	public void setInlineResponseAttachments( boolean inlineResponseAttachments )
159 	{
160 		boolean old = getSettings().getBoolean( INLINE_RESPONSE_ATTACHMENTS );
161 		getSettings().setBoolean( INLINE_RESPONSE_ATTACHMENTS, inlineResponseAttachments );
162 		notifyPropertyChanged( INLINE_RESPONSE_ATTACHMENTS, old, inlineResponseAttachments );
163 	}
164 
165 	public boolean isExpandMtomResponseAttachments()
166 	{
167 		return getSettings().getBoolean( EXPAND_MTOM_RESPONSE_ATTACHMENTS );
168 	}
169 
170 	public void setExpandMtomResponseAttachments( boolean expandMtomResponseAttachments )
171 	{
172 		boolean old = getSettings().getBoolean( EXPAND_MTOM_RESPONSE_ATTACHMENTS );
173 		getSettings().setBoolean( EXPAND_MTOM_RESPONSE_ATTACHMENTS, expandMtomResponseAttachments );
174 		notifyPropertyChanged( EXPAND_MTOM_RESPONSE_ATTACHMENTS, old, expandMtomResponseAttachments );
175 	}
176 
177 	/***
178 	 * Use getResponse().getContentAsString();
179 	 * 
180 	 * @deprecated
181 	 */
182 
183 	@Deprecated
184 	public String getResponseContent()
185 	{
186 		return getResponse() == null ? null : getResponse().getContentAsString();
187 	}
188 
189 	public WsdlResponse getResponse()
190 	{
191 		return ( WsdlResponse )super.getResponse();
192 	}
193 
194 	public WsdlOperation getOperation()
195 	{
196 		return operation;
197 	}
198 
199 	public void setOperation( WsdlOperation wsdlOperation )
200 	{
201 		WsdlOperation oldOperation = operation;
202 		this.operation = wsdlOperation;
203 
204 		definedAttachmentParts = null;
205 		notifyPropertyChanged( OPERATION_PROPERTY, oldOperation, operation );
206 	}
207 
208 	public void setRequestContent( String request )
209 	{
210 		definedAttachmentParts = null;
211 		super.setRequestContent( request );
212 	}
213 
214 	// public void setResponse( WsdlResponse response, SubmitContext context )
215 	// {
216 	// WsdlResponse oldResponse = getResponse();
217 	// this.response = response;
218 	//		
219 	// notifyPropertyChanged( RESPONSE_PROPERTY, oldResponse, response );
220 	// }
221 
222 	public WsdlSubmit<WsdlRequest> submit( SubmitContext submitContext, boolean async ) throws SubmitException
223 	{
224 		String endpoint = PropertyExpander.expandProperties( submitContext, getEndpoint() );
225 		if( endpoint == null || endpoint.trim().length() == 0 )
226 		{
227 			UISupport.showErrorMessage( "Missing endpoint for request [" + getName() + "]" );
228 			return null;
229 		}
230 
231 		try
232 		{
233 			WsdlSubmit<WsdlRequest> submitter = new WsdlSubmit<WsdlRequest>( this, getSubmitListeners(),
234 					RequestTransportRegistry.getTransport( endpoint, submitContext ) );
235 			submitter.submitRequest( submitContext, async );
236 			return submitter;
237 		}
238 		catch( Exception e )
239 		{
240 			throw new SubmitException( e.toString() );
241 		}
242 	}
243 
244 	private class InternalInterfaceListener extends InterfaceListenerAdapter implements PropertyChangeListener
245 	{
246 		public void propertyChange( PropertyChangeEvent evt )
247 		{
248 			if( evt.getPropertyName().equals( Interface.ENDPOINT_PROPERTY ) )
249 			{
250 				String endpoint = getEndpoint();
251 				if( evt.getOldValue() != null && evt.getOldValue().equals( endpoint ) )
252 				{
253 					setEndpoint( ( String )evt.getNewValue() );
254 				}
255 			}
256 		}
257 	}
258 
259 	public String getWssPasswordType()
260 	{
261 		String wssPasswordType = getConfig().getWssPasswordType();
262 		return StringUtils.isNullOrEmpty( wssPasswordType ) || PW_TYPE_NONE.equals( wssPasswordType ) ? null
263 				: wssPasswordType;
264 	}
265 
266 	public void setWssPasswordType( String wssPasswordType )
267 	{
268 		if( wssPasswordType == null || wssPasswordType.equals( PW_TYPE_NONE ) )
269 		{
270 			if( getConfig().isSetWssPasswordType() )
271 				getConfig().unsetWssPasswordType();
272 		}
273 		else
274 		{
275 			getConfig().setWssPasswordType( wssPasswordType );
276 		}
277 	}
278 
279 	/*
280 	 * (non-Javadoc)
281 	 * 
282 	 * @see
283 	 * com.eviware.soapui.impl.wsdl.AttachmentContainer#getDefinedAttachmentParts
284 	 * ()
285 	 */
286 
287 	public synchronized HttpAttachmentPart[] getDefinedAttachmentParts()
288 	{
289 		if( definedAttachmentParts == null )
290 		{
291 			try
292 			{
293 				UISupport.setHourglassCursor();
294 				definedAttachmentParts = AttachmentUtils.extractAttachmentParts( operation, getRequestContent(), true,
295 						false, isMtomEnabled() );
296 			}
297 			catch( Exception e )
298 			{
299 				log.warn( e.toString() );
300 				definedAttachmentParts = new ArrayList<HttpAttachmentPart>();
301 			}
302 			finally
303 			{
304 				UISupport.resetCursor();
305 			}
306 		}
307 
308 		return definedAttachmentParts.toArray( new HttpAttachmentPart[definedAttachmentParts.size()] );
309 	}
310 
311 	public RestRequestInterface.RequestMethod getMethod()
312 	{
313 		return RestRequestInterface.RequestMethod.POST;
314 	}
315 
316 	/*
317 	 * (non-Javadoc)
318 	 * 
319 	 * @see
320 	 * com.eviware.soapui.impl.wsdl.AttachmentContainer#getAttachmentPart(java
321 	 * .lang.String)
322 	 */
323 	public HttpAttachmentPart getAttachmentPart( String partName )
324 	{
325 		HttpAttachmentPart[] parts = getDefinedAttachmentParts();
326 		for( HttpAttachmentPart part : parts )
327 		{
328 			if( part.getName().equals( partName ) )
329 				return part;
330 		}
331 
332 		return null;
333 	}
334 
335 	public void copyTo( WsdlRequest newRequest, boolean copyAttachments, boolean copyHeaders )
336 	{
337 		newRequest.setEncoding( getEncoding() );
338 		newRequest.setEndpoint( getEndpoint() );
339 		newRequest.setRequestContent( getRequestContent() );
340 		newRequest.setWssPasswordType( getWssPasswordType() );
341 
342 		CredentialsConfig credentials = getConfig().getCredentials();
343 		if( credentials != null )
344 			newRequest.getConfig().setCredentials( ( CredentialsConfig )credentials.copy() );
345 
346 		if( copyAttachments )
347 			copyAttachmentsTo( newRequest );
348 
349 		if( copyHeaders )
350 			newRequest.setRequestHeaders( getRequestHeaders() );
351 
352 		// ((DefaultWssContainer)newRequest.getWssContainer()).updateConfig( (
353 		// WSSConfigConfig ) getConfig().getWssConfig().copy() );
354 	}
355 
356 	/*
357 	 * (non-Javadoc)
358 	 * 
359 	 * @see com.eviware.soapui.impl.wsdl.AttachmentContainer#isMtomEnabled()
360 	 */
361 	public boolean isMtomEnabled()
362 	{
363 		return getSettings().getBoolean( WsdlSettings.ENABLE_MTOM );
364 	}
365 
366 	public void setMtomEnabled( boolean mtomEnabled )
367 	{
368 		getSettings().setBoolean( WsdlSettings.ENABLE_MTOM, mtomEnabled );
369 		definedAttachmentParts = null;
370 	}
371 
372 	public boolean isInlineFilesEnabled()
373 	{
374 		return getSettings().getBoolean( WsdlRequest.ENABLE_INLINE_FILES );
375 	}
376 
377 	public void setInlineFilesEnabled( boolean inlineFilesEnabled )
378 	{
379 		getSettings().setBoolean( WsdlRequest.ENABLE_INLINE_FILES, inlineFilesEnabled );
380 	}
381 
382 	public boolean isSkipSoapAction()
383 	{
384 		return getSettings().getBoolean( WsdlRequest.SKIP_SOAP_ACTION );
385 	}
386 
387 	public void setSkipSoapAction( boolean skipSoapAction )
388 	{
389 		getSettings().setBoolean( WsdlRequest.SKIP_SOAP_ACTION, skipSoapAction );
390 	}
391 
392 	@Override
393 	public void release()
394 	{
395 		super.release();
396 
397 		getOperation().getInterface().removeInterfaceListener( interfaceListener );
398 		getOperation().getInterface().removePropertyChangeListener( interfaceListener );
399 	}
400 
401 	public MessagePart[] getRequestParts()
402 	{
403 		try
404 		{
405 			List<MessagePart> result = new ArrayList<MessagePart>();
406 			result.addAll( Arrays.asList( getOperation().getDefaultRequestParts() ) );
407 			result.addAll( Arrays.asList( getDefinedAttachmentParts() ) );
408 
409 			return result.toArray( new MessagePart[result.size()] );
410 		}
411 		catch( Exception e )
412 		{
413 			SoapUI.logError( e );
414 			return new MessagePart[0];
415 		}
416 	}
417 
418 	public MessagePart[] getResponseParts()
419 	{
420 		try
421 		{
422 			List<MessagePart> result = new ArrayList<MessagePart>();
423 			result.addAll( Arrays.asList( getOperation().getDefaultResponseParts() ) );
424 
425 			if( getResponse() != null )
426 				result.addAll( AttachmentUtils.extractAttachmentParts( getOperation(), getResponse().getContentAsString(),
427 						true, true, isMtomEnabled() ) );
428 
429 			return result.toArray( new MessagePart[result.size()] );
430 		}
431 		catch( Exception e )
432 		{
433 			SoapUI.logError( e );
434 			return new MessagePart[0];
435 		}
436 	}
437 
438 	public String getWssTimeToLive()
439 	{
440 		return getSettings().getString( WSS_TIMETOLIVE, null );
441 	}
442 
443 	public void setWssTimeToLive( String ttl )
444 	{
445 		getSettings().setString( WSS_TIMETOLIVE, ttl );
446 	}
447 
448 	public long getContentLength()
449 	{
450 		return getRequestContent().length();
451 	}
452 
453 	public boolean isForceMtom()
454 	{
455 		return getSettings().getBoolean( FORCE_MTOM );
456 	}
457 
458 	public void setForceMtom( boolean forceMtom )
459 	{
460 		boolean old = getSettings().getBoolean( FORCE_MTOM );
461 		getSettings().setBoolean( FORCE_MTOM, forceMtom );
462 		notifyPropertyChanged( FORCE_MTOM, old, forceMtom );
463 	}
464 
465 	public boolean isEncodeAttachments()
466 	{
467 		return getSettings().getBoolean( ENCODE_ATTACHMENTS );
468 	}
469 
470 	public void setEncodeAttachments( boolean encodeAttachments )
471 	{
472 		boolean old = getSettings().getBoolean( ENCODE_ATTACHMENTS );
473 		getSettings().setBoolean( ENCODE_ATTACHMENTS, encodeAttachments );
474 		notifyPropertyChanged( ENCODE_ATTACHMENTS, old, encodeAttachments );
475 	}
476 
477 	public String getIncomingWss()
478 	{
479 		return getConfig().getIncomingWss();
480 	}
481 
482 	public void setIncomingWss( String incomingWss )
483 	{
484 		String old = getIncomingWss();
485 		getConfig().setIncomingWss( incomingWss );
486 		notifyPropertyChanged( INCOMING_WSS, old, incomingWss );
487 	}
488 
489 	public String getOutgoingWss()
490 	{
491 		return getConfig().getOutgoingWss();
492 	}
493 
494 	public void setOutgoingWss( String outgoingWss )
495 	{
496 		String old = getOutgoingWss();
497 		getConfig().setOutgoingWss( outgoingWss );
498 		notifyPropertyChanged( OUGOING_WSS, old, outgoingWss );
499 	}
500 
501 	public boolean isWsAddressing()
502 	{
503 		return getConfig().getUseWsAddressing();
504 	}
505 
506 	public void setWsAddressing( boolean wsAddressing )
507 	{
508 		boolean old = getConfig().getUseWsAddressing();
509 		getConfig().setUseWsAddressing( wsAddressing );
510 		notifyPropertyChanged( "wsAddressing", old, wsAddressing );
511 	}
512 
513 	public PropertyExpansion[] getPropertyExpansions()
514 	{
515 		PropertyExpansionsResult result = new PropertyExpansionsResult( this, this );
516 		result.addAll( super.getPropertyExpansions() );
517 
518 		StringToStringMap requestHeaders = getRequestHeaders();
519 		for( String key : requestHeaders.keySet() )
520 		{
521 			result.addAll( PropertyExpansionUtils.extractPropertyExpansions( this, new RequestHeaderHolder(
522 					requestHeaders, key ), "value" ) );
523 		}
524 		addWsaPropertyExpansions( result, getWsaConfig(), this );
525 		addJMSHeaderExpansions( result, getJMSHeaderConfig(), this );
526 		return result.toArray();
527 	}
528 
529 	public void addWsaPropertyExpansions( PropertyExpansionsResult result, WsaConfig wsaConfig, ModelItem modelItem )
530 	{
531 		result.addAll( PropertyExpansionUtils.extractPropertyExpansions( modelItem, wsaConfig, "action" ) );
532 		result.addAll( PropertyExpansionUtils.extractPropertyExpansions( modelItem, wsaConfig, "from" ) );
533 		result.addAll( PropertyExpansionUtils.extractPropertyExpansions( modelItem, wsaConfig, "to" ) );
534 		result.addAll( PropertyExpansionUtils.extractPropertyExpansions( modelItem, wsaConfig, "replyTo" ) );
535 		result.addAll( PropertyExpansionUtils.extractPropertyExpansions( modelItem, wsaConfig, "replyToRefParams" ) );
536 		result.addAll( PropertyExpansionUtils.extractPropertyExpansions( modelItem, wsaConfig, "faultTo" ) );
537 		result.addAll( PropertyExpansionUtils.extractPropertyExpansions( modelItem, wsaConfig, "faultToRefParams" ) );
538 		result.addAll( PropertyExpansionUtils.extractPropertyExpansions( modelItem, wsaConfig, "relatesTo" ) );
539 		result.addAll( PropertyExpansionUtils.extractPropertyExpansions( modelItem, wsaConfig, "relationshipType" ) );
540 		result.addAll( PropertyExpansionUtils.extractPropertyExpansions( modelItem, wsaConfig, "messageID" ) );
541 	}
542 
543 	public void addJMSHeaderExpansions( PropertyExpansionsResult result, JMSHeaderConfig jmsHeaderConfig,
544 			ModelItem modelItem )
545 	{
546 		result.addAll( PropertyExpansionUtils.extractPropertyExpansions( modelItem, jmsHeaderConfig,
547 				JMSHeader.JMSCORRELATIONID ) );
548 		result.addAll( PropertyExpansionUtils
549 				.extractPropertyExpansions( modelItem, jmsHeaderConfig, JMSHeader.JMSREPLYTO ) );
550 		result.addAll( PropertyExpansionUtils.extractPropertyExpansions( modelItem, jmsHeaderConfig, JMSHeader.JMSTYPE ) );
551 		result.addAll( PropertyExpansionUtils.extractPropertyExpansions( modelItem, jmsHeaderConfig,
552 				JMSHeader.JMSPRIORITY ) );
553 		result.addAll( PropertyExpansionUtils
554 				.extractPropertyExpansions( modelItem, jmsHeaderConfig, JMSHeader.DURABLE_SUBSCRIPTION_NAME ) );
555 		result.addAll( PropertyExpansionUtils
556 				.extractPropertyExpansions( modelItem, jmsHeaderConfig, JMSHeader.CLIENT_ID ) );
557 	}
558 
559 	public class RequestHeaderHolder
560 	{
561 		private final StringToStringMap valueMap;
562 		private final String key;
563 
564 		public RequestHeaderHolder( StringToStringMap valueMap, String key )
565 		{
566 			this.valueMap = valueMap;
567 			this.key = key;
568 		}
569 
570 		public String getValue()
571 		{
572 			return valueMap.get( key );
573 		}
574 
575 		public void setValue( String value )
576 		{
577 			valueMap.put( key, value );
578 			setRequestHeaders( valueMap );
579 		}
580 	}
581 
582 	public AttachmentEncoding getAttachmentEncoding( String partName )
583 	{
584 		HttpAttachmentPart attachmentPart = getAttachmentPart( partName );
585 		if( attachmentPart == null )
586 			return AttachmentUtils.getAttachmentEncoding( getOperation(), partName, false );
587 		else
588 			return AttachmentUtils.getAttachmentEncoding( getOperation(), attachmentPart, false );
589 	}
590 
591 	public WsaConfig getWsaConfig()
592 	{
593 		if( wsaConfig == null )
594 		{
595 			if( !getConfig().isSetWsaConfig() )
596 			{
597 				getConfig().addNewWsaConfig();
598 			}
599 			wsaConfig = new WsaConfig( getConfig().getWsaConfig(), this );
600 		}
601 		return wsaConfig;
602 	}
603 
604 	public ModelItem getModelItem()
605 	{
606 		return this;
607 	}
608 
609 	public boolean isWsaEnabled()
610 	{
611 		return isWsAddressing();
612 	}
613 
614 	public void setWsaEnabled( boolean arg0 )
615 	{
616 		setWsAddressing( arg0 );
617 	}
618 
619 	public boolean isWsReliableMessaging()
620 	{
621 		return getConfig().getUseWsReliableMessaging();
622 	}
623 
624 	public void setWsReliableMessaging( boolean wsReliableMessaging )
625 	{
626 		boolean old = getConfig().getUseWsReliableMessaging();
627 		getConfig().setUseWsReliableMessaging( wsReliableMessaging );
628 		notifyPropertyChanged( "wsReliableMessaging", old, wsReliableMessaging );
629 	}
630 
631 	public WsrmConfig getWsrmConfig()
632 	{
633 		if( wsrmConfig == null )
634 		{
635 			if( !getConfig().isSetWsrmConfig() )
636 			{
637 				getConfig().addNewWsrmConfig();
638 			}
639 			wsrmConfig = new WsrmConfig( getConfig().getWsrmConfig(), this );
640 		}
641 		return wsrmConfig;
642 	}
643 
644 	public boolean isWsrmEnabled()
645 	{
646 		return isWsReliableMessaging();
647 	}
648 
649 	public void setWsrmEnabled( boolean arg0 )
650 	{
651 		setWsReliableMessaging( arg0 );
652 	}
653 
654 	public String getResponseContentAsXml()
655 	{
656 		return getResponse() == null ? null : getResponse().getContentAsString();
657 	}
658 
659 	private JMSHeaderConfig jmsHeaderConfig;
660 	private JMSPropertiesConfig jmsPropertyConfig;
661 
662 	public JMSHeaderConfig getJMSHeaderConfig()
663 	{
664 		if( jmsHeaderConfig == null )
665 		{
666 			if( !getConfig().isSetJmsConfig() )
667 			{
668 				getConfig().addNewJmsConfig();
669 			}
670 			jmsHeaderConfig = new JMSHeaderConfig( getConfig().getJmsConfig(), this );
671 		}
672 		return jmsHeaderConfig;
673 	}
674 
675 	public JMSPropertiesConfig getJMSPropertiesConfig()
676 	{
677 		if( jmsPropertyConfig == null )
678 		{
679 			if( !getConfig().isSetJmsPropertyConfig() )
680 			{
681 				getConfig().addNewJmsPropertyConfig();
682 			}
683 			jmsPropertyConfig = new JMSPropertiesConfig( getConfig().getJmsPropertyConfig(), this );
684 		}
685 		return jmsPropertyConfig;
686 	}
687 
688 	public String getAction()
689 	{
690 		if( isWsaEnabled() && StringUtils.hasContent( getWsaConfig().getAction() ) )
691 		{
692 			return getWsaConfig().getAction();
693 		}
694 
695 		return getOperation().getAction();
696 	}
697 }