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