1
2
3
4
5
6
7
8
9
10
11
12
13 package com.eviware.soapui.impl.wsdl.submit;
14
15 import java.util.ArrayList;
16 import java.util.List;
17
18 import com.eviware.soapui.impl.wsdl.WsdlOperation;
19 import com.eviware.soapui.impl.wsdl.support.soap.SoapVersion;
20 import com.eviware.soapui.model.ModelItem;
21 import com.eviware.soapui.model.iface.Attachment;
22
23 /***
24 * MessageExchange for WSDL-based exchanges
25 *
26 * @author ole.matzura
27 */
28
29 public abstract class AbstractWsdlMessageExchange<T extends ModelItem> extends AbstractMessageExchange<T> implements
30 WsdlMessageExchange
31 {
32 public AbstractWsdlMessageExchange( T modelItem )
33 {
34 super( modelItem );
35 }
36
37 public boolean hasResponse()
38 {
39 String responseContent = getResponseContent();
40 return responseContent != null && responseContent.trim().length() > 0;
41 }
42
43 public abstract WsdlOperation getOperation();
44
45 public Attachment[] getResponseAttachmentsForPart( String name )
46 {
47 List<Attachment> result = new ArrayList<Attachment>();
48
49 for( Attachment attachment : getResponseAttachments() )
50 {
51 if( attachment.getPart().equals( name ) )
52 result.add( attachment );
53 }
54
55 return result.toArray( new Attachment[result.size()] );
56 }
57
58 public Attachment[] getRequestAttachmentsForPart( String name )
59 {
60 List<Attachment> result = new ArrayList<Attachment>();
61
62 for( Attachment attachment : getRequestAttachments() )
63 {
64 if( attachment.getPart().equals( name ) )
65 result.add( attachment );
66 }
67
68 return result.toArray( new Attachment[result.size()] );
69 }
70
71 public boolean hasRequest( boolean ignoreEmpty )
72 {
73 String requestContent = getRequestContent();
74 return !( requestContent == null || ( ignoreEmpty && requestContent.trim().length() == 0 ) );
75 }
76
77
78
79
80
81
82
83 public SoapVersion getSoapVersion()
84 {
85 return getOperation().getInterface().getSoapVersion();
86 }
87
88 public boolean hasRawData()
89 {
90 return false;
91 }
92
93 public byte[] getRawRequestData()
94 {
95 return null;
96 }
97
98 public byte[] getRawResponseData()
99 {
100 return null;
101 }
102 }