{
org.wsdmdemo.service.weatherStationDir.AddWeatherStationResponseDocument responseDocument = org.wsdmdemo.service.weatherStationDir.AddWeatherStationResponseDocument.Factory.newInstance();
org.wsdmdemo.service.weatherStationDir.AddWeatherStationResponseDocument.AddWeatherStationResponse response = responseDocument.addNewAddWeatherStationResponse();
ResourcePropertySet resourcePropertySet = ((PropertiesResource) getResource()).getResourcePropertySet();
ResourceProperty resourceProperty = resourcePropertySet.get(WeatherStationDirPropertyQNames.RELATIONSHIP);
//get the request epr
org.wsdmdemo.service.weatherStationDir.AddWeatherStationDocument.AddWeatherStation addWeatherStation = requestDoc.getAddWeatherStation();
org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceType addedEpr = addWeatherStation.getEndpointReference();
//define a relationship
RelationshipDocument relationshipDocument = RelationshipDocument.Factory.newInstance();
//define the relationship type
RelationshipType relationshipType = InteropRequestUtils.createRelationshipType(relationshipDocument.addNewRelationship());
//add self as a participant
RelationshipParticipantType parentRelationshipParticipantType = relationshipType.addNewParticipant();
WeatherStationDirResource resource = (WeatherStationDirResource) getResource();
XmlBeansEndpointReference xmlEpr = (XmlBeansEndpointReference) resource.getEndpointReference();
EndpointReferenceType dirEndpointReferenceType = (EndpointReferenceType) xmlEpr.getXmlObject(AddressingConstants.NSURI_ADDRESSING_SCHEMA);
parentRelationshipParticipantType.setResourceId(InteropConstants.DIR_RESOURCEID);
parentRelationshipParticipantType.setRole(InteropConstants.PARENT_RELATION);//uri
parentRelationshipParticipantType.setManageabilityEndpointReferenceArray(new EndpointReferenceType[]{dirEndpointReferenceType});
//add the new ws as the other participant
RelationshipParticipantType childRelationshipParticipantType = relationshipType.addNewParticipant();
childRelationshipParticipantType.setResourceId(InteropRequestUtils.getResourceId(addedEpr));
childRelationshipParticipantType.setRole(InteropConstants.CHILD_RELATION);//uri
childRelationshipParticipantType.setManageabilityEndpointReferenceArray(new EndpointReferenceType[]{addedEpr});
resourceProperty.add(relationshipDocument);
return responseDocument;
}