<!-- prettier-ignore-start -->
# Class WebReference

- [TopLevel.Object](TopLevel.Object.md)
  - [dw.rpc.WebReference](dw.rpc.WebReference.md)

Represents a web service defined in a WSDL file. The implementation is backed by a JAX-RPC framework.
You should use the newer dw.ws package and [WebReference2](dw.ws.WebReference2.md) class instead, which is based on JAX-WS.


Use the Services module in Business Manager to set timeout values, not the methods for this class.
The Services module provides better analytics and timeout management.

To create an instance of a WebReference object, in a B2C Commerce Script file, reference a WSDL file in the `webreferences`
directory and request the service [Stub](dw.rpc.Stub.md) using one of the get service methods.
For example, if your WSDL file is `MyWSDL.wsdl`,
to create an instance of WebReference and access the [Stub](dw.rpc.Stub.md):



```
var webref : WebReference = webreferences.MyWSDL;
var stub : Stub = webref.getDefaultService();
```


**Note:** script classes representing your WSDL file are are generated by the platform and then placed in the `WebReferences`
package. You do not need to include the `importPackage`
statement in your B2C Commerce Script file to use classes in the `WebReferences` package.


**See Also:**
- [Stub](dw.rpc.Stub.md)
- [SOAPUtil](dw.rpc.SOAPUtil.md)

**Deprecated:**
:::warning
This class is deprecated, please use webreferences2 instead (see also [WebReference2](dw.ws.WebReference2.md)).
            
In migrating from webreferences to webreferences2 the property `collectionType=indexed` may be helpful.
            Setting this in the property file for the WSDL will make the generated API more closely resemble the API generated by webreferences.

:::

## Property Summary

| Property | Description |
| --- | --- |
| ~~[defaultService](#defaultservice): [Stub](dw.rpc.Stub.md)~~ `(read-only)` | Returns the default service of the WebReference object. |

## Constructor Summary

| Constructor | Description |
| --- | --- |
| [WebReference](#webreference)() |  |

## Method Summary

| Method | Description |
| --- | --- |
| ~~[getDefaultService](dw.rpc.WebReference.md#getdefaultservice)()~~ | Returns the default service of the WebReference object. |
| ~~[getService](dw.rpc.WebReference.md#getservicestring-string)([String](TopLevel.String.md), [String](TopLevel.String.md))~~ | Returns a specific service from this WebReference. |

### Methods inherited from class Object

[assign](TopLevel.Object.md#assignobject-object), [create](TopLevel.Object.md#createobject), [create](TopLevel.Object.md#createobject-object), [defineProperties](TopLevel.Object.md#definepropertiesobject-object), [defineProperty](TopLevel.Object.md#definepropertyobject-object-object), [entries](TopLevel.Object.md#entriesobject), [freeze](TopLevel.Object.md#freezeobject), [fromEntries](TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](TopLevel.Object.md#hasownpropertystring), [is](TopLevel.Object.md#isobject-object), [isExtensible](TopLevel.Object.md#isextensibleobject), [isFrozen](TopLevel.Object.md#isfrozenobject), [isPrototypeOf](TopLevel.Object.md#isprototypeofobject), [isSealed](TopLevel.Object.md#issealedobject), [keys](TopLevel.Object.md#keysobject), [preventExtensions](TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](TopLevel.Object.md#propertyisenumerablestring), [seal](TopLevel.Object.md#sealobject), [setPrototypeOf](TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](TopLevel.Object.md#tolocalestring), [toString](TopLevel.Object.md#tostring), [valueOf](TopLevel.Object.md#valueof), [values](TopLevel.Object.md#valuesobject)
## Property Details

### defaultService
- ~~defaultService: [Stub](dw.rpc.Stub.md)~~ `(read-only)`
  - : Returns the default service of the WebReference object. If you have more than one service
      defined in your WSDL, the default service is the first service alphabetically. If the service
      has multiple ports defined, the default service uses the SOAP port name that is first alphabetically.


    **Deprecated:**
:::warning
use webreferences2 instead
:::

---

## Constructor Details

### WebReference()
- WebReference()
  - : 


---

## Method Details

### getDefaultService()
- ~~getDefaultService(): [Stub](dw.rpc.Stub.md)~~
  - : Returns the default service of the WebReference object. If you have more than one service
      defined in your WSDL, the default service is the first service alphabetically. If the service
      has multiple ports defined, the default service uses the SOAP port name that is first alphabetically.


    **Returns:**
    - the default service of the WebReference object.

    **Deprecated:**
:::warning
use webreferences2 instead
:::

---

### getService(String, String)
- ~~getService(service: [String](TopLevel.String.md), port: [String](TopLevel.String.md)): [Stub](dw.rpc.Stub.md)~~
  - : Returns a specific service from this WebReference.

    **Parameters:**
    - service - the service to locate.
    - port - the port name to use.  
```
 var port =  webref.getService("SampleServiceName","SamplePortName");
```


    **Returns:**
    - a specific service from this WebReference.

    **Deprecated:**
:::warning
use webreferences2 instead
:::

---

<!-- prettier-ignore-end -->
